WordPress: Older posts, newer posts

I always get confused by “Previous page” and “Next page” on WordPress blogs. After only a little struggling, I finally got my navigation sorted out so that you can page through it using “Older posts” and “Newer posts”.

I added the following to my style.css:


.navigation { font-weight: bold; font-size: larger }
.navigation .right { float: right }
.navigation .left { float: left }

Then I added this to my theme’s index.php:

<div class="navigation">
  <div class="left">
    <?php next_posts_link('&laquo; Older posts'); ?>
  </div><div class="right">
    <?php previous_posts_link('Newer posts &raquo;'); ?>
  </div>
</div>

Result: yay!

image

  • http://blog.georgezamfir.com George Z

    Oh yeah, on every wordpress installation this is a must. I still don’t get why they keep it like this. And it’s also the “next post” vs “previous post” (for those using it, where “next post” IS THE OLDER POST :)

  • Aleksey Tsalolikhin

    Thanks for the useful tip and for your inspiring blog! Keep up the good work.

    Best,
    Aleksey

  • http://coevolving.com David Ing

    Thanks for the usability tip. I happened to be hacking my theme — I actually decided not to change it, using plugins instead — but since I already had the directory open, and the Filezilla fired up, I made the changes: “older” and “newer”.