For a local directory, i have a 'businesses' CPT with 2 taxonomies - 'location' and 'type'.

I am trying to figure out the best way to create taxonomy term archive pages such as:


After a few hours of searching, this is what i've come across:

a) A custom taxonomy (term) archive template file is needed: taxonomy-$taxonomy-$term.php

b) This posts talks about using 'tax_query'


c) This post seems to have most of the essential ideas (&code) but it combines and lists all the second taxonomy's posts in the same page, whereas i would like to list them in individual pages.


Just to clarify. AFAIK, it queries the first taxonomy (location) and gets the term 'Seattle', and then queries the second taxonomy (type) in order to list all the second taxonomy terms and posts (that are in both the first and second taxonomies) on the same page:


- Post Title 1
- Post Ttile 2

- Post Title 5
- Post Title 4
- Post Title 6

- Post Title 9


1) The result above is suitable for a 'location' taxonomy terms archive page ie. "example.com/state/city" but how do i modify the code from the TutsPlus article to get an archive page that filters both 'location' & 'type' taxonomies to produce something like "example.com/state/city/bakeries"?

2) Since 'Seattle' and 'Bakeries' are both taxonomy terms, does this solution lie in the same "taxonomy-$taxonomy-$term.php" file even though they are terms from different taxonomies?

3) Ideally, it would be good to be able to have archive pages for "example.com/state/bakeries" too. Does this mean that states and cities would need to be in separate taxonomies? The current plan is to have cities as a child of states under the same taxonomy 'location'.

Note: i am new to PHP and can copy/paste examples together by trial & error. I think the solution may include parts of b) and c) but i just don't know how to write the code.

Thanks for your suggestions & feedback.

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.