Avoid empty result category queries. Props andy. fixes #3416
git-svn-id: https://develop.svn.wordpress.org/trunk@4580 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
893c5fa38e
commit
7b8f7aedc1
@ -238,7 +238,10 @@ function wp_list_categories($args = '') {
|
||||
$output .= __("No categories");
|
||||
} else {
|
||||
global $wp_query;
|
||||
$r['current_category'] = $wp_query->get_queried_object_id();
|
||||
|
||||
if ( is_category() )
|
||||
$r['current_category'] = $wp_query->get_queried_object_id();
|
||||
|
||||
if ( $hierarchical )
|
||||
$depth = 0; // Walk the full depth.
|
||||
else
|
||||
|
@ -619,13 +619,14 @@ class Walker_Category extends Walker {
|
||||
$link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp);
|
||||
}
|
||||
|
||||
$_current_category = get_category( $current_category );
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user