Codex

Function Reference/next posts link

Contents

Description

Prints a link to the next set of posts within the current query.

If you need the values for use in PHP, use get_next_posts_link().

Because post queries are usually sorted in reverse chronological order, next_posts_link() usually points to older entries (toward the end of the set) and prev_posts_link() usually points to newer entries (toward the beginning of the set).

Usage

 <?php next_posts_link$label $max_pages ); ?> 

Parameters

$label
(string) (optional) The link text.
Default: 'Next Page »'
$max_pages
(integer) (optional) Limit the number of pages on which the link is displayed. The default value "0" means "no limit".
Default: 0

Examples

Default Usage

<?php next_posts_link(); ?>

Working example

<?php next_posts_link('Older Entries »', 0); ?>

Notes

  • This function will not work (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.

Resources

Related

body_class(), next_image_link(), next_post_link(), next_posts_link(), post_class(), post_password_required(), posts_nav_link(), previous_image_link(), previous_post_link(), previous_posts_link(), single_post_title, sticky_class(), the_category(), the_category_rss(), the_content(), the_content_rss(), the_excerpt(), the_excerpt_rss(), the_ID(), the_meta(), the_shortlink(), the_tags(), the_title(), the_title_attribute(), the_title_rss(), wp_link_pages()

See also index of Function Reference and index of Template Tags.