In Wordpress I have three custom post types: exhibitions, books, movies. I have one taxonomy with two taxonomy terms (store-1 and store-2) that can be applied to all CPTs.
What I need to achieve is to have one page with the permalink www.mysite.com/exhibitions where posts tagged with both store-1 and store-2 are listed, and this can be done easily with CPTs. However, I would also like to have permalinks such as www.mysite.com/exhibitions/store-1 where all posts with the store-1 taxonomy from the exhibitions CPT are listed (and so on for each CPT and each taxonomy term). This however creates a mix of CPT and taxonomy terms in the permalink, and I don't know how to do that.
My guess would be to invert the logic and create three custom taxonomies named exhibitions, books and movies (of course I would need to change the CPT slugs to cpt-exhibitions, cpt-books and cpt-movies), and for each of them create the terms store-1 and store-2. In this way I would get permalinks such as www.mysite.com/exhibitions/store-1. Regarding the permalinks such as www.mysite.com/exhibitions, I was thinking about creating a page with the slug "exhibition" with a custom template for that page. In the php of the template I would add a loop to get all the cpt-exhibitions posts, no matter the taxonomy term.
This is not a really clean solution since I would have basically three empty pages in the backend used solely for permalink purposes. So I was wondering: is there a specific function or rewrite rule to achieve what I need with CPTs named exhibitions, books, movies and only one custom taxonomy (e.g. store) applied to all CPTs?
Thank you for the insights!
www.mysite.com/exhibitions/store/store-1
as you didn't ask for that I won't put the answer just yet, but if it's something you're interested in let me know. – amarinediary...website/exhibitions/
is the equivalent to...website/?post_type=exhibitions
query. Make sure when registering your custom post type you haehas_archive
set to true. – amarinediary