Adding previous/next post links

Please Note: Theme customizations go beyond the scope of our support services and this article is provided solely as a courtesy to our customers. Please take a moment to review the Scope of our Support.

To add the previous / next post links to your single post page, you have to open the single.php file and insert the following code:

echo '<div class="alignleft">';
previous_post_link('%link', 'Previous post', false);
echo '</div><div class="alignright">';
next_post_link('%link', 'Next post', false);
echo '</div><div class="clear"></div>';

just after the line that includes the post template file. In our latest themes, this line should look like this:

locate_template( array( 'includes/post-template.php'), true, false );

and for older themes, this line should be like this:

include(TEMPLATEPATH . '/includes/single-blog.php');

For more information about the previous_post_link function, you can refer to its reference on the WordPress site:

http://codex.wordpress.org/Function_Reference/previous_post_link

 

For more information about the next_post_link function, you can refer to its reference on the WordPress site:

http://codex.wordpress.org/Function_Reference/next_post_link

Was this useful? 1