3. Wordpress Next and Previous Links for Single Pages

On a single page (which uses your single.php template) “the loop” gets a single post, so you can’t use a pagination plugin like we just did. After a post on your “single.php” by default Wordpress shows a linked title to your previous and next posts (if there is one). I try to spruce this up just a little to users understand what these links really are with code like this:

<div class="navigation">
 <div class="alignleft"><?php previous_post_link('<b>&laquo; Post before this:</b> %link') ?><br /></div>
 <div class="alignright"><?php next_post_link('%link <b>&raquo; Post After This</b>') ?></div>
 <div style="clear:both;"></div>
</div>

Basically all I did here was add some bolded text before and after the links. Maybe you can think of something a little more poignant for your links – or style them better than my example here. Go to the next hack below…

Pages: 1 2 3 4 5 6 7 8 9 10 11

This post has multiple pages...

  1. 10 Ways to Improve Navigation
  2. Page 2 - Adding Breadcrumbs to Wordpress Navigation
  3. Page 3 - How to Hack Ugly Wordpress Next and Previous Links
  4. Page 4 - Wordpress Next and Previous Links for Single Pages
  5. Page 5 - Wordpress More Links and Excerpts
  6. Page 6 - How to Achieve Multi-Paged Post Navigation in Wordpress
  7. Page 7 - How to Add Related Posts After Content in Wordpress
  8. Page 8 - How to Display the Most Viewed Posts in Wordpress
  9. Page 9 - How to Show Most Popular Posts in Wordpress
  10. Page 10 - How to Assign and Show Category Images in Wordpress
  11. Page 11 - Sidebar Navigation Options in Wordpress
  12. View All

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,