I have a site with a category structure that is large, deep, and dynamic. I want to use a category template based on a conditional statement that uses the current category depth level.
I don't want to use is_category('13,14,15') because with hundreds of categories, that may be added and removed, I don't want to hard code every category ID in a certain level.
In an ideal world, this would be my code (unfortunately there is no such conditional statement):
<?php
if ( is_category_level('1') ) {
include(TEMPLATEPATH . '/category-level-1.php');
} elseif ( is_category_level('2') ) {
include(TEMPLATEPATH . '/category-level-2.php');
} elseif ( is_category_level('3') ) {
include(TEMPLATEPATH . '/category-level-3.php');
} else {
include(TEMPLATEPATH . '/category.php');
}
?>
Here are two forum posts that might be similar: http://wordpress.org/support/topic/369287?replies=4, and http://wordpress.org/support/topic/338561?replies=8.
Can anyone help me figure out how to specify the category template based on category level?
Thank you!