Avoid empty result category queries. Props andy. fixes #3416

git-svn-id: http://svn.automattic.com/wordpress/trunk@4580 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-12-01 18:55:27 +00:00
parent c198077fcc
commit aedf76aa2f
2 changed files with 8 additions and 4 deletions

View File

@ -238,7 +238,10 @@ function wp_list_categories($args = '') {
$output .= __("No categories");
} else {
global $wp_query;
if ( is_category() )
$r['current_category'] = $wp_query->get_queried_object_id();
if ( $hierarchical )
$depth = 0; // Walk the full depth.
else

View File

@ -619,13 +619,14 @@ class Walker_Category extends Walker {
$link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp);
}
if ( $current_category )
$_current_category = get_category( $current_category );
if ( 'list' == $args['style'] ) {
$output .= "\t<li";
if ( ($category->cat_ID == $current_category) && is_category() )
if ( $current_category && ($category->cat_ID == $current_category) )
$output .= ' class="current-cat"';
elseif ( ($category->cat_ID == $_current_category->category_parent) && is_category() )
elseif ( $_current_category && ($category->cat_ID == $_current_category->category_parent) )
$output .= ' class="current-cat-parent"';
$output .= ">$link\n";
} else {