I am building an art gallery website using a custom post type "paintings". There is a custom taxonomy for categories called "painting_cat" where it can be "studio", "plein air" etc., and another custom taxonomy called "series" so that paintings that are part of a series can be grouped together.
Paintings can be in both a category and a series. I have created an taxonomy archive page that handles the list of paintings in a series.
On my single-painting.php template, I am using next_post_link()
and previous_post_link()
as navigation to go to the next painting and prev painting. However, when coming from the taxonomy-series.php archive page, these links don't maintain the query data. They show every painting.
I would like for the next and prev buttons to only show paintings that are in the same series as the taxonomy-series.php page the user just came from.
Is there a way to do this? I am wondering if it has to do with the permalink structure or if there is a naming convention to use for single posts that can be something to the effect of: single-{post-type}-{taxonomy}.php
I have been searching high and low and haven't found anything that will do exactly what I am trying to accomplish.