0

I have a custom post type called "Activities" with different taxonomies. One of this taxonomies has three subtaxonomies. Is there a template for single subtaxonomies only? And if yes, is there a way to display it in template hierarchy?

At this point taxonomy and subtaxonomies contents are displayed in the same taxonomy page.

Thank you!

1

I'm not sure what you mean about sub-taxonomies. Are you referring to the actual term? If so you could use the following to template it:

taxonomy-$taxonomy-$term.php

An example of this would be if I had a taxonomy called genres and a term called horror, I could then template this as:

taxonomy-genres-horror.php

Refer to the template hierarchy for more:

https://developer.wordpress.org/themes/template-files-section/taxonomy-templates/

3
  • Hello Chris, thanks for the reply. This is my hierarchy: - Activities (custom post type) - Activities categories (custom taxonomies) - What to see (main taxonomy) - City (sub taxonomy of What to see) So the page hierarchy should be: taxonomy-{taxonomy}-{term}-{sub-term}.php so activities_categories-what-to-see-city.php I would like to know if it's possible to create a page only for this subtaxonomy.
    – Stefano
    Oct 10 '17 at 16:19
  • To be more clear I would like to know if it's possible to generate a page like this taxonomy-genres-horror-subgenre.php Thank you
    – Stefano
    Oct 11 '17 at 10:22
  • I suppose the short answer would be no. There isn't a way to assign a template in the hierarchy that way. Organizationally, you may want to reconsider your approach. However, if you need to, you could redirect the default generated page to a new one (like a 301) and build your own query based on the parameters you need. Reference codex.wordpress.org/Class_Reference/… for building your own query. Oct 11 '17 at 14:10

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.