Support » How-To and Troubleshooting » code for detect the next post of a subcategory
6 years, 3 months ago
How should I code in wordpress to detect the next and previous post of a subcategory.
Take your pick:
I can’t get this to work for subcategories. It seems to only work with top level categories.
Here is my code:
<?php next_post_link_menu('%link', '« Previous Project', TRUE, '6 and 7'); ?>
The posts I want to page through are in category 5, I want to exclude categories 6 and 7. The problem is that categories 5, 6, and 7 are all children of another category.
Have a look at the links I gave above. It’s next_posts_link.
The codes which I used is as follows.
<?php if (in_category(’26’))
next_post_link(‘%link’, ‘Next post’, TRUE);
previous_post_link(‘%link’, ‘Previous post’, TRUE);
This suppose to work fine, but its not working. This give the previous next post from all the categories.
Please help me with this.
I have 3 posts in a subcategory named Film. I just want the navigation between these 3 posts.
I am stuck with this. Is there anyone who can help me with this.
Yea, same problem I am having. The links above do not help. They only work when you are dealing with top level categories. They do not work when you want to only page through the posts in a subcategory.
Sorry, the code I posted earlier uses the post mash filter plugin, even if i use the following code, the other categories are not excluded:
`<?php next_post_link(‘%link’, ‘« Previous Project’, TRUE, ‘6 and 7′); ?>’
Hi there please do help me with this. I am stuck with my project.
[moderated–bumps removed. Please refrain from bumping as per Forum Rules]