There is a slight problem that I cannot figure out by myself:
I created a custom post type (tours
) with custom taxonomy (tour categories
). I have created a taxonomy-tour-categories.php
to display an archive
page for each tour category. Works perfect.
I have a tour category
(School tours
) which needs a different layout, so I added a second template taxonomy-tour-categories-shool-tours.php
with my desired layout. Again it works perfect.
The problem is that the 'school tours'
tour category has its own subcategories (like 'workshops'
, 'science labs'
and so on) which I would like to be displayed by the taxonomy.tour-categories-school-tours.php
template, but are displayed by the taxonomy.tours-categories.php
template. Why that?
I thought that wordpress - when a template file for a specific term is missing - would fall back to the immediately above level template file (in this case taxonomy.tours-categories-school-tours.php
). What am I missing?
Thanks for your help!
There is a slight problem that I cannot figure out by myself:
I created a custom post type (tours
) with custom taxonomy (tour categories
). I have created a taxonomy-tour-categories.php
to display an archive
page for each tour category. Works perfect.
I have a tour category
(School tours
) which needs a different layout, so I added a second template taxonomy-tour-categories-shool-tours.php
with my desired layout. Again it works perfect.
The problem is that the 'school tours'
tour category has its own subcategories (like 'workshops'
, 'science labs'
and so on) which I would like to be displayed by the taxonomy.tour-categories-school-tours.php
template, but are displayed by the taxonomy.tours-categories.php
template. Why that?
I thought that wordpress - when a template file for a specific term is missing - would fall back to the immediately above level template file (in this case taxonomy.tours-categories-school-tours.php
). What am I missing?
Thanks for your help!
As you can see in this image, template hierarchy limits to taxonomy-$taxonomy-$term.php
.
I don't know why a subterm falls back to taxonomy-$taxonomy.php
, but I guess it searches for a taxonomy-$taxonomy-$term.php
in wich $term
would be workshops
, science labs
and so on. And since those don't exist (I suppose), it falls back on taxonomy-$taxonomy.php
.
You could make use of a workaround in your taxonomy-$taxonomy.php
file wich loads the requested taxonomy-$taxonomy-$term.php
file when the $term
has a parent $term
.