Codex tools: Log in / create account
Contents |
Used on single post permalink pages, this template tag displays a link to the previous post which exists in chronological order from the current post.
This tag must be used in The Loop.
<?php previous_post_link('format', 'link', in_same_cat,
'excluded_categories'); ?>
Displays link with left angular quote («) followed by the post title of the previous post (chronological post date order). By default, this tag works like previous_post().
<?php previous_post_link(); ?>
Displays link with previous chronological post's title wrapped in 'strong' tags (typically sets text to bold).
<?php previous_post_link('<strong>%link</strong>'); ?>
Displays custom text as link to the previous post within the same category as the current post. Post title is not included here. "Previous in category" is the custom text, which can be changed to fit your requirements.
<?php previous_post_link('%link', 'Previous in category', TRUE); ?>
Displays link to previous post in the same category, as long as it is not in category 13 (the category ID #). You can change the number to any category you wish to exclude. Exclude multiple categories by using " and " as a delimiter.
<?php previous_post_link('%link', 'Previous in category', TRUE, '13'); ?>
See also next_post_link().
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