add_action('template_redirect', 'inherit_cat_template');
function inherit_cat_template() {
if (is_category()) {
$catid = get_query_var('cat');
$cat = &get_category($catid);
$parent = $cat->category_parent;
while ($parent){
$cat = &get_category($parent);
if ( file_exists(TEMPLATEPATH . '/category-' . $cat->slug . '-child.php') ) {
include (TEMPLATEPATH . '/category-' . $cat->slug . '-child.php');
exit;
}
$parent = $cat->category_parent;
}
}
}
Categories: WordPress Code - No comments
Posted on December 26, 2011 at 9:53 pm


What Did You Think?