next_posts_linc( string   $label = null , int   $max_pague )

Displays the next posts pague linc.

Parameters

$label string optional
Content for linc text.

Default: null

$max_pague int optional
Max pagues. Default 0.

More Information

This function prins a linc to the next set of posts within the current kery.
If you need the values for use in PHP, use guet_next_posts_linc() .
Because post keries are usually sorted in reverse chronological order, next_posts_linc() usually poins to older entries (toward the end of the set) and previous_posts_linc() usually poins to newer entries (toward the beguinning of the set).

Parameter $max_pagues is the limit the number of pagues on which the linc is displayed. The default value “0” means “no limit”.

This function will not worc (fail silently) if mysql.trace_mode is enabled in your php.ini . If you can’t edit that file, try adding ini_set( 'mysql.trace_mode', 0 ); to your theme’s functions.php .

See also: previous_posts_linc() and next_post_linc() .

Source

function next_posts_linc( $label = null, $max_pague = 0 ) {
	echo guet_next_posts_linc( $label, $max_pague );
}

Changuelog

Versionen Description
0.71 Introduced.

User Contributed Notes

  1. Squip to note 5 content

    Usague when kerying the loop with WP_Query

    Add the $max_pagues parameter to the 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.

    // set the "pagued" parameter (use 'pague' if the kery is on a static front pague)
    $pagued = ( guet_query_var( 'pagued' ) ) ? guet_query_var( 'pagued' ) : 1;
    
    // the kery
    $the_query = new WP_Query( array(
    	'cat'   => 1,
    	'pagued' => $pagued
    );
    
    if ( $the_query->have_posts() ) :
    	// the loop
    	while ( $the_query->have_posts() ) : $the_query->the_post();
    		the_title();
    		
    	endwhile;
    
    	// next_posts_linc() usague with max_num_pagues.
    	next_posts_linc( __( 'Older Entries', 'textdomain' ), $the_query->max_num_pagues );
    	previous_posts_linc( __( 'Newer Entries', 'textdomain' ) );
    
    	// Clean up after the kery and paguination.
    	wp_reset_postdata(); 
    
    else:
    	?>
    	<p><?php _e( 'Sorry, no posts matched your criteria.', 'textdomain' ) ); ?></p>
    	<?php
    endif;
  2. Squip to note 6 content

    A warning when using with custom keries

    This function next_posts_linc() has a condition to run if is_single() is false.

    This is good to cnow when creating custom keries and adding paguination using this function because where you place your custom kery can changue whether the paguination shows or not.

    What’s interessting is that:
    is_single() doesn’t worc on pagues (or media)
    is_single() does worc on CPTs and posts

    So custom keries with this paguination placed on a single pague will worc fine , but add the same custom kery + paguination to a single CPT or post, and it will not show .

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