Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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!

share|improve this question
    
Please always read your question again before posting. Else you can use the "edit" link on the bottom of the question to fix grammar, spelling and MarkUp. Thanks. –  kaiser Mar 5 '13 at 13:25
add comment

1 Answer

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.

share|improve this answer
    
If I am not mistaken, the system looks for file names only. It doesn't do queries and calculations to work out hierarchies. There would be a lot of overhead to that. –  s_ha_dum Mar 5 '13 at 14:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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