Okay
  Public Ticket #3402128
Next/Prev Post display with Custom Post types
Closed

Comments

  •  3
    aenoch started the conversation

    I have a custom post type called Projects with its own categories, and in my single-project.php template (in a child theme) I have the nectar_next_post_display(); code. 

    It is working (it displays the next and previous posts with an arrow to go to them) but it is displaying all of the Projects, and I'd like to limit it to the same category as the current post. 

    If I click "Limit Post Navigation To Same Category"  in the Salient options, I don't see anything at all, the area is blank. 

    If I leave it un-clicked, I see all the Projects, not just the ones in the same category. 

    Any ideas on how to limit the scope of it to just the same category as my current custom post type?

    Much appreciated! Thankyou!

  •  2,958
    Andrew replied

    Hi there,

    Thanks for reaching out.

    That function nectar_next_post_display uses another function such as get_previous_post and get_next_post to get the previous and next posts which are limited to the same category.

    You can see this in the function's definition in the file salient\nectar\helpers\blog.php line 200 - 207

    What you can do is implement similar functions on your child theme to do the same.
    You can see an implementation of how the adjacent posts are grabbed from the database here salient\nectar\helpers\pagination.php using the be_get_adjacent_post function.

    Hope you can work from there.
    Noah.

  •  3
    aenoch replied

    Thanks Noah. I'll sort it out! :)