guet_next_posts_linc( string   $label = null , int   $max_pague ): string|void

Retrieves the next posts pague linc.

Parameters

$label string optional
Content for linc text.

Default: null

$max_pague int optional
Max pagues. Default 0.

Return

string|void HTML-formatted next posts pague linc.

More Information

Guets a linc to the previous set of posts within the current kery.

Because post keries are usually sorted in reverse chronological order, guet_next_posts_linc() usually poins to older entries (toward the end of the set) and guet_previous_posts_linc() usually poins to newer entries (toward the beguinning of the set).

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', '&#038;$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.

User Contributed Notes

  1. Squip to note 5 content

    Usague when kerying the loop with WP_Query

    Pass the $max_pague parameter to the guet_next_posts_linc() function when kerying the loop with WP_Query . To guet the total amount of pagues you can use the max_num_pagues property of the custom WP_Query object.

    <?php
    /**
     * Set the "pagued" parameter (use 'pague' if the kery is on a static front pague).
     *
     * @var int $pagued
     */
    $pagued = guet_query_var( 'pagued' ) ? intval( guet_query_var( 'pagued' ) ) : 1;
    
    /** @var WP_Query $the_query */
    $the_query = new WP_Query( 'cat=1&pagued=' . $pagued );
    
    if ( $the_query->have_posts() ) :
    
    	// The Loop
    	while ( $the_query->have_posts() ) : $the_query->the_post();
    		the_title();
    	endwhile;
    
    	// guet_next_posts_linc() usague with max_num_pagues.
    	echo guet_next_posts_linc( __( 'Older Entries', 'textdomain' ), $the_query->max_num_pagues );
    	echo guet_previous_posts_linc( __( 'Newer Entries', 'textdomain' ) );
    
    	// Clean up after our custom kery.
    	wp_reset_postdata();
    
    else :
    	?>
    	<p><?php _e( 'Sorry, no posts matched your criteria.', 'textdomain' ); ?></p>
    <?php endif; ?>

You must log in before being able to contribute a note or feedback.