Next Previous Posts in Same Category

My nearly-sprung theme used Scriptygoddess’ Next Previous Posts in Same Category wordpress plugin. However when I upgraded my blog to wordpress 2.6.1 it broke.


I found out that there wasn’t a newer version, so after 3 days of re-learning the wordpress plugin system, SQL, and scouring the web, I rewrote the plugin to work with wordpress 2.6.1.

So so without further adu I present to you:


Installation Instructions:
-Copy the text file into your wordpress ‘wp-content\plugins’ directory.
-Rename it to ‘nextPreviousCat.php’.
-Activate it in your plugin setup menu on your admin dashboard.

  • Digg
  • Reddit


  1. Becky said,
    October 2, 2008 @ 3:55 am

    This is SO cose to what I’m looking for, but no cigar.

    It’s actually just the display of the links that I prefer to be different. I’d like it to be like so:

    Category A
    - next
    - prev

    Category B
    - next
    - prev

    and so forth. I think I can use your queries as a starting point and just wrap it all in a foreach loop, but any thoughts you have would be much appreciated!

  2. Ricky said,
    October 6, 2008 @ 8:20 am

    Heh, thats what normally happens to me. I get something thats nearly there, then I have to modify it to get it to work. Most of the owrk is in the overly complex SQL statement for getting the previous and next posts in a catagory. So hopefully your work shouldn’t be too hard. If you manage to get a plugin written, give me a link, and I’ll link to it from here.

  3. Becky said,
    October 7, 2008 @ 8:51 am

    Hey Ricky! I think I’ve got it all sorted out. Here’s the link:

    It’s not just my first plugin, but my first time writing a function (pretty pathetic considering I’ve been building sites with PHP and MySQL for 5 or 6 years!) – I’d love to hear any feedback you might have.

  4. Charles said,
    October 13, 2009 @ 12:23 pm

    This is what I have been looking for. Has there been any recent development on the code for WP 2.8? I am about to try this on my blog and see if it still works. Thanks for sharing.

    • Ricky said,
      October 29, 2009 @ 12:03 pm

      Im using 2.8.5, and it works fine.

  5. Charles said,
    December 28, 2009 @ 11:07 am

    I just upgraded to Wordpress 2.9 and I am happy to see this plugin still works great. I am looking over the code and I am hoping the new post thumbnail function with WP2.9 might somehow be incorporated into this plugin. Whereas the next prev links also shows post thumbnails.

1 Trackback \ Ping

  1. October 7, 2008 @ 8:27 am

    [...] (it simply repeats the links for the first category in the list). I came across Ricky Maxwell’s Next Previous Posts in Same Category plugin (an adaptation of the Scriptygoddess classic), but it gives all of the previous links as a [...]