Changeset 11814
- Timestamp:
- 08/14/2009 04:56:51 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/theme.php
r11545 r11814 591 591 * Retrieve path of category template in current or parent template. 592 592 * 593 * Works by retrieving the current category ID, for example 'category-1.php' and594 * will fallback to category.php template, if the ID category file doesn't595 * exist.593 * Works by first retrieving the current slug for example 'category-default.php' and then 594 * trying category ID, for example 'category-1.php' and will finally fallback to category.php 595 * template, if those files don't exist. 596 596 * 597 597 * @since 1.5.0 … … 601 601 */ 602 602 function get_category_template() { 603 $template = locate_template(array("category-" . absint( get_query_var('cat') ) . '.php', 'category.php')); 603 $cat_ID = absint( get_query_var('cat') ); 604 $category = get_category( $cat_ID ); 605 606 $templates = array(); 607 608 if ( !is_wp_error($category) ) 609 $templates[] = "category-{$category->slug}.php"; 610 611 $templates[] = "category-$cat_ID.php"; 612 $templates[] = "category.php"; 613 614 $template = locate_template($templates); 604 615 return apply_filters('category_template', $template); 605 616 }
Note: See TracChangeset
for help on using the changeset viewer.