[Resolved] Next / Previous links on single content (custom post type)

Home Forums Support Next / Previous links on single content (custom post type)

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1160330
    Matthew

    Had a good look around but couldn’t find an answer to this… I bet it’s something simple though!

    I have a custom post type, and several custom taxonomies.

    When I view a single post from this custom post type, how can I make the next / previous links only show links to posts with the same post type AND matching one of the custom taxonomies on the currently viewed post.

    For example, the post type could be “Figures” with a custom taxonomy of “Year”. If I am viewing a “Figure” from the “Year” 1985, the next / previous should only show figures from 1985. Currently I can only get it to show links to all figures.

    Thanks,
    Matt

    #1160367
    Matthew

    Just stumbled upon a solution to this in the “General Setting” and “Reading” section (after installing a plugin)

    There’s an option there to “Keep Pagination in Same Taxonomy” and it gives you tick boxes for all Taxonomies.

    Would be interested to know if there is a way to do this with a function though.

    Thanks,
    Matt

    #1160461
    David
    Staff
    Customer Support
    #1160506
    Matthew

    Hi,

    That didn’t work but I found out how to do it.

    previous_post_link( ‘%link’, ‘%title’, TRUE, ‘ ‘, ‘MY-CUSTOM-TAXONOMY’ );
    and
    next_post_link( ‘%link’, ‘%title’, TRUE, ‘ ‘, ‘MY-CUSTOM-TAXONOMY’ );

    give me the result that I was looking for, so I don’t need that extra plugin now either.

    Thanks,
    Matt

    #1160509
    David
    Staff
    Customer Support

    Glad to hear you found a solution

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