Archived topic
Thumbnails in prev/next navigation do not stay within category
3 replies · Started by Callista on April 14, 2019
Hi Leo, Tom, and all,
So this code is working great if I don't want to just navigate within a category. If I turn that on (ie, change row 25 from "false" to "true": $category_specific = apply_filters( 'generate_category_post_navigation', true );), the navigation titles and links are fine but the thumbnails do not match. They seem to be the next and previous thumbnails of posts in general, and are not staying within the category. I do not know enough php to troubleshoot this myself...
Thanks so much.
Have a great day!
Best,
Callista
Hi there,
instead of using the filter, try editing the function Tom provided, you will find 2 instances of:
$prevPost = get_previous_post();
These should become:
$prevPost = get_previous_post( true );
https://codex.wordpress.org/Function_Reference/get_previous_post
Yay! That works!! Thanks so much!
(Please note that the second instance of $prevPost = get_previous_post(true); should actually be $nextPost = get_next_post(true); - see my comment here.)
Have a great day!
Best,
Callista
Glad to be of help. Yes i thought that was peculiar to have two previous_posts but i didn't read all the post as to what it was doing lol :)