Next/Previous post in same category?
Is there a way to fix the ‘in_same_cat’ option in previous_post() and next_post()? It’s been broken for as long as I can remember.
I’ve been using a plugin that does the same work but it only works by ID and not by date, which is a bit of a problem since most of my posts aren’t in chronological order.
Couple plugin options that address this:
I tried the Meyerweb plugin but the same category option seems to be broken all the same.
The one by Scriptygoddess is what I’m using right now, but it only works by post ID and not by date. I’m no good at SQL queries so I wouldn’t know how to fix that.
Has the issue of getting next/previous posts within the category of the post been solved? The “within category” feature doesn’t seem to work…yet…on the template tags.
I gave Meyer’s next/previous tags a whirl and they work ~~okay~~. I had to fix the code to force it to work.
<?php mw_previous_post('%', '', 'The previous article is ', '.', 'yes', 'yes') ?>
<?php mw_next_post('%', '', ' The next article is ', '.', 'yes', 'yes') ?>
From Meyer’s next/previous plugin returns:
“The previous article is Previous Article Title. The next article is Next Article Title. “
The problem is that I can’t get it to do posts from within the same category. It still follows chronological from any category. Not what I want.
From Scriptgodess next/previous posts in same category I was able to create a similar effect, but the plugin grabs every category that post is in and gives you the next and previous from each category. So if I have one post that is in three categories, along with three other “similar” articles, I get three lists of previous articles, all the same title, and three lists of next articles, all the same title. Not good.
So the Scriptgoddess code does what I want, but I would have to keep every post in ONE category. Since I have a lot of subcategories, this makes it complicated because if I have a Parent Category 1, with the post in Sub-Category 3, I still get a listing for the next and previous in Parent Category 1 and two each for Sub-Category 3. For links to the same two articles I do not need.
Has anyone found anything better for keeping the next/previous postings WITHIN the same category?
ThatÂ´s it… I thought I did something wrong, but looks like Meyer’s plugin behavies as the default WordPress functions next_post and previous_post, at least at Wp 1.5.
Thank God itÂ´s not just ME! LOL
It’s not you. But I sure wish it was US getting it right! I’m desperate to keep my NEXT and PREVIOUS in the same category. Any luck in finding any working code solution?
Lorelle… nothing seems to work. I tried Scriptgoddess too and had the same problem as you did, because a lot of my posts are in two or maybe three different categories.
IÂ´m thinking about merging some categories and using posts in just one. CanÂ´t think on anything else, nothing is working!!
There just HAS to be a fix to this. It’s making me nuts. It’s about the last thing that I want to fix before going public with my new WordPress site that I’ve been working on for MONTHS.
This has been broken ever since multiple categories per post functionality was introduced. Multiple categories complicates matters. Are two posts considered to be “in the same category” if they have any category in common. If so, when navigating from post A to post B to post C, posts A and C may have no category in common. A and C can share a category with B but not with each other.
Ryan, that’s not true. I use it, and it show all categories, even the posts that are in another category, alone.
I wouldn’t like my “personal blog” to be among all the other posts, and it has itÂ´s own category, but using PREV, NEXT, even with Meyer’s plugin, shows everything!
I donÂ´t think there is a solution for this!
I’m talking about what the fixed behavior should or should not be, not what the current behavior is. The current behavior is obviously broken.
ok! now I got it! lol
you can see english is not my language at all! 😉
So, 8 months later, and there is no fix or work around for this, right? It would be nice if someone would re-enable the $excluded_categories parameters of:
so that when one wants something in the SAME category that happens to be in MULTIPLE categeories, that they can EXCLUDE the categeories that they don’t want.
- The topic ‘Next/Previous post in same category?’ is closed to new replies.