[Resolved] Thumbnails in prev/next navigation do not stay within category

Home Forums Support [Resolved] Thumbnails in prev/next navigation do not stay within category

Home Forums Support Thumbnails in prev/next navigation do not stay within category

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #868884
    Callista

    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

    #869248
    David
    Staff
    Customer Support

    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

    #869360
    Callista

    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

    #869369
    David
    Staff
    Customer Support

    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 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.