Query of custom post type to call post with conditional term
-
I have the following set up:
2 custom post types: galleries and artists;
1 taxonomy: gallery-names
3 terms of the above taxonomy: a, b, and cgallery-names is attached to both galleries and artists, because I want whatever gallery term is called to just call the artists from that term.
My single-galleries.php is set up where the original loop is the single gallery, and nested inside of it is a wp-query for artists. I also have a speakers nav list dynamically populating the sidebar with anchor links. It works nicely, but when gallery a, b or c is displayed, it shows ALL the artists not just the artist attached to their respective gallery. What I would like to happen is when gallery ‘a’ is displayed, only artists ‘a’ will show, when gallery ‘b’ is displayed, only artists ‘b’ show, etc.
I haven’t created separate taxonomy templates for these. Should I make separate ones for each gallery i.e. single-galleries-gallery-names-a.php, single-galleries-gallery-names-b.php, single-galleries-gallery-names-c.php? And if so, what would the query loop look like?
- The topic ‘Query of custom post type to call post with conditional term’ is closed to new replies.