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:
parent
c198077fcc
commit
aedf76aa2f
|
@ -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