Site icon Hip-Hop Website Design and Development

Previous/Next custom post links within custom taxonomy

I have seen this issue in quite a few threads so apologies if I’ve replicated an issue here but I’ve had no joy in attempting to implement the solutions I have found.

I have a custom post type: show, to which is assigned a custom taxonomy: show_status. This can be set either to current or past.

In the single-show.php template of my theme I have placed the following:

<div class="newerlink"><p><?php next_post_link('%link', 'Next &rsaquo;', $in_same_term = true, $excluded_terms = '', $taxonomy = 'show_status' ); ?></p></div>
<div class="olderlink"><p><?php previous_post_link('%link', '&lsaquo; Previous', $in_same_term = true, $excluded_terms = '', $taxonomy = 'show_status' ); ?></p></div>

I want the user to be able to navigate within shows categorised as current OR as past but not to move from one type to the other.

I have tried several versions of these links and all show either no links at all or links which do not differentiate between the show_status and pass from post to post without stopping. All have been variants on the basic:

<div class="newerlink"><p><?php next_post_link('%link', 'Next &rsaquo;', TRUE ); ?></p></div>
<div class="olderlink"><p><?php previous_post_link('%link', '&lsaquo; Previous', TRUE ); ?></p></div>

I imagine I haven’t quite got it right yet. I’ve also tried this method, which rendered links but didn’t respect the change in show_status either.

The loop in single-show.php is as standard in a post template:

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    // content
<?php endwhile; ?>    
<?php else: ?>
<?php endif; ?>

Where different content is needed by category I am using:

<?php if (has_term('current', 'show_status')) { ;?>

or

<?php if (has_term('past', 'show_status')) { ;?>

to differentiate.

How can I get this to work as intended?