I've found this simple yet elegant solution for make Wordpress using the same template category on every child and grandchild categories https://stackoverflow.com/a/3117202/391929
Full code:
function myTemplateSelect() {
if (is_category() && !is_feed()) {
if (is_category(get_cat_id('projects')) || cat_is_ancestor_of(get_cat_id('projects'), get_query_var('cat'))) {
load_template(TEMPLATEPATH . '/category-projects.php');
exit;
}
}
}
add_action('template_redirect', 'myTemplateSelect');
But I still have one problem: in my case the root category (on the above example the "projects" category) should not use the that template, but a different one, so I made this simple change in the snippet:
function myTemplateSelect() {
if (is_category() && !is_feed()) {
if (cat_is_ancestor_of(get_cat_id('projects'), get_query_var('cat'))) {
load_template(TEMPLATEPATH . '/category-projects-tree.php');
exit;
}
}
}
But for some reason this is not working, can anyone see why?