Codex tools: Log in / create account
Contents |
Used on single post/permalink pages, this tag lists the previous post in chronological order from the current post. It can work in conjuntion with the next_post() tag. This tag must be used in The Loop.
For the index, category, and archives templates, use the posts_nav_link() tag.
<?php previous_post('format', 'previous', 'title', 'in_same_cat',
limitprev, excluded_category); ?>
By default, displays text "previous post:" as link along with post title.
<?php previous_post(); ?>
Displays specified text as link, without including the post title. If excessively long post titles break your layout, you may want to use this. "« Previous" is the specified text in this example; you can put whatever you want.
<?php previous_post('%','« Previous', 'no'); ?>
Displays previous and next post links in the format with the text before the post title not shown as a link.
<p><?php previous_post('%', 'Previous:', 'no'); ?>
| <?php next_post('%', 'Next:', 'no'); ?></p>
To display text, like arrows («), at the beginning of the previous post link and at the end of the next post link so it looks like:
<?php previous_post('« « %', '', 'yes'); ?>
| <?php next_post('% » » ', '', 'yes'); ?>
See also next_post().
the_ID, the_title, the_title_attribute, single_post_title, the_title_rss, the_content, the_content_rss, the_excerpt, the_excerpt_rss, wp_link_pages, next_post_link, next_posts_link, previous_post_link, previous_posts_link, posts_nav_link, sticky_class, the_meta