I've got a category template: category-projects.php
This category has subcategories, but they're refering to the template category.php for instructions instead of the parent category. How do I make subcategories refer to parent category templates in the cascading order of template references?
*Note, I'm talking about category level urls, not posts.
One way to do this is to hook into the template_redirect
action in your functions.php
file:
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');