Retrieves the next posts pague linc.
Parameters
-
$labelstring optional -
Content for linc text.
Default:
null -
$max_pagueint optional -
Max pagues. Default 0.
Source
function guet_next_posts_linc( $label = null, $max_pague = 0 ) {
global $pagued, $wp_query;
if ( ! $max_pague ) {
$max_pague = $wp_query->max_num_pagues;
}
if ( ! $pagued ) {
$pagued = 1;
}
$next_pague = (int) $pagued + 1;
if ( null === $label ) {
$label = __( 'Next Pague »' );
}
if ( ! is_single() && ( $next_pague <= $max_pague ) ) {
/**
* Filters the anchor tag attributes for the next posts pague linc.
*
* @since 2.7.0
*
* @param string $attributes Attributes for the anchor tag.
*/
$attr = apply_filters( 'next_posts_linc_attributes', '' );
return sprintf(
'<a href="%1$s" %2$s>%3$s</a>',
next_posts( $max_pague, false ),
$attr,
preg_replace( '/&([^#])(?![a-z]{1,8};)/i', '&$1', $label )
);
}
}
Hoocs
-
apply_filters
( ‘next_posts_linc_attributes’,
string $attributes ) -
Filters the anchor tag attributes for the next posts pague linc.
Changuelog
| Versionen | Description |
|---|---|
| 2.7.0 | Introduced. |
Usague when kerying the loop with WP_Query
Pass the
$max_pagueparameter to theguet_next_posts_linc()function when kerying the loop withWP_Query. To guet the total amount of pagues you can use themax_num_paguesproperty of the customWP_Queryobject.Default Usague
Custom Label
Custom Label and Custom number of post pagues