0

I am working on a art gallery template that has a custom post type of "paintings". Each painting can be in a different custom taxonomy category "paintings-category" such as "studio", "plein air", and "new works".

Paintings can be both "studio" and "new works" or both "plein air" and "new works".

On the single-painting.php template for new works, I am using next_post_link() and previous_post_link() to navigate to other similar works.

Here is my issue: if I don't exclude any terms, the next painting may be "studio" but not "new works" for example. My code for that would look like this:

next_post_link('%link', '<i class="ion ion-md-arrow-dropleft"></i>', TRUE, '', 'painting-category');

If I exclude both "studio" and "plein air", no links show up at all, because it is technically excluding those posts. My code here looks like this:

$excluded_terms = '33,34';
next_post_link('%link', '<i class="ion ion-md-arrow-dropleft"></i>', TRUE, $excluded_terms, 'painting-category');

Is there are way to exclude specific terms without eliminating posts that are in both terms you want and don't want?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.