Definition:
function get_category_template() {}
Retrieve path of category template in current or parent template.
Works by first retrieving the current slug for example ‘category-default.php’ and then trying category ID, for example ‘category-1.php’ and will finally fallback to category.php template, if those files don’t exist.
Source code
function get_category_template() {
$category = get_queried_object();
$templates = array();
$templates[] = "category-{$category->slug}.php";
1258

February 12, 2011 


No comments yet... Be the first to leave a reply!