Previous / Next links for Custom Post Types

Posted in wordpress

I was able to get the previous/next links to work using the following code for custom taxonomy. The link to the full thread is below.

<div class="previous-post-link"> <?php previous_post_link('%link', '<< Previous Post', $in_same_term = true, $excluded_terms = '', $taxonomy = 'the-custom-taxonomy-associated-with-your-custom-post-type'); ?> </div> <div class="next-post-link"> <?php next_post_link('%link', 'Next Post >>', $in_same_term = true, $excluded_terms = '', $taxonomy = 'the-custom-taxonomy-associated-with-your-custom-post-type'); ?> </div>

Full article:
https://wordpress.stackexchange.com/questions/57867/next-and-previous-link-in-custom-post-type-in-the-same-taxonomy-term

WordPress Codex: Get Adjacent Post
https://codex.wordpress.org/Function_Reference/get_adjacent_post