Site logo

Archived topic

Post Navigation limited to category

9 replies · Started by Yael on November 11, 2020

Viewing posts 1–10 of 10

Hello,

I read the other threads in the forum and added the appropriate code snippet to my child theme's function.php file

add_filter( 'generate_category_post_navigation', '__return_true' );

However, the post navigation is not limited to category as you can see here:

https://aviadrealty.com/gc-free-standing/

Is there something else I need to do in order to limit post navigation to category?

Hi,

However, the post navigation is not limited to category as you can see here:

Strange.

Adding this snippet as it is should work without any issues.

Any chance you could provide use temporary site access so we could check any implementation issues?

You can provide the site details on the Private Information text field. Thank you.

Sure, posted below.

Hi there,

i checked one Category and looked at this post: /gc-free-standing and next and previous posts were correct and from the same category.

Is there a particular post category that its not working ?

Can you share a screenshot b/c on that particular post, I'm still seeing post navigation include posts from all categories?

Okay, just dawned on me, perhaps that shortcode only applies to main categories and not sub categories.

This website has two main categories with lots of sub categories; I want to limit post navigation to posts within the sub categories, not the main category.

For example:

Jerusalem Rentals is the main category but has dozens of sub categories. I want to limit post navigation to the the sub category each post is in.... b/c each sub category is a specific area in Jerusalem

So for the listing you mentioned, it is in German Colony Rentals (a sub category of Jerusalem Rentals).

Hi there,

I've just done some looking around for this and I couldn't find an easy-to-implement solution, unfortunately.

Using the filter above, is it working for child categories as well as the parent category? So in theory, we just need to exclude the parent category?

Hi Tom. NO need to exclude the parent category.

Apparently I'm still not seeing what you all are seeing even though I've cleared my cache multiple times.

I still post navigation from other sub categories rather than, for example on the post viewed above, only from the German Colony.

https://aviadrealty.com/gc-free-standing/

The listing is under Jerusalem Rentals > German Colony but the before and after posts are from City Center and Abu Tor (two different sub categories).

So you are seeing before and after listings only within German Colony?

OH, wait, my correction. yes we would need to exclude the parent category as it's what is pulling in the posts from all the sub categories :)

I've been digging some more but I can't find any solid example, unfortunately.

The only thing I found is someone saying they only added the child category to their posts (left the parent category un-checked) and that worked for them. Not sure if that's something that will work in your case?

This archived topic is closed to new replies.