Codex tools: Log in / create account
Contents |
Displays links for next and previous pages. Useful for providing "paged" navigation of index, category and archive pages.
For displaying next and previous post navigation on individual posts, see next_post_link() and previous_post_link().
<?php posts_nav_link('sep','prelabel','nxtlabel'); ?>
Note that since weblog posts are traditionally listed in reverse chronological order (with most recent posts at the top), there is some ambiguity in the definition of "next page". WordPress defines "next page" as the "next page toward the past". In WordPress 1.5, the default Kubrick theme addresses this ambiguity by labeling the "next page" link as "previous entries". See Example: Kubrick Theme Format.
== Examples ==
By default, the posts_nav_link look like this:
<?php posts_nav_link(); ?>
Displays previous and next page links ("previous page · next page") centered on the page.
<div style="text-align:center;">
<?php posts_nav_link(' · ', 'previous page', 'next page'); ?>
</div>
<?php posts_nav_link(' ', '<img src="images/prev.jpg" />', '<img src="images/next.jpg" />'); ?>
The Kubrick theme format for posts navigation.
<div class="navigation">
<div class="alignleft"><?php posts_nav_link('','','« Previous Entries') ?></div>
<div class="alignright"><?php posts_nav_link('','Next Entries »','') ?></div>
</div>
You can change the text in each of the links and in the text in between the links.
<p><?php posts_nav_link(' or ', 'You can go back
to the previous page', 'you can go
forward to the next page'); ?>.</p>
the_ID, the_title, the_title_attribute, single_post_title, the_title_rss, the_content, the_content_rss, the_excerpt, the_excerpt_rss, previous_post_link, next_post_link, posts_nav_link, the_meta