Ticket #3416: cat.diff

File cat.diff, 1.5 kB (added by andy, 2 years ago)
  • wp-includes/category-template.php

    old new  
    241241                        $output .= __("No categories"); 
    242242        } else { 
    243243                global $wp_query; 
    244                 $r['current_category'] = $wp_query->get_queried_object_id(); 
     244                 
     245                if ( is_category() ) 
     246                        $r['current_category'] = $wp_query->get_queried_object_id(); 
     247 
    245248                if ( $hierarchical ) 
    246249                        $depth = 0;  // Walk the full depth. 
    247250                else 
  • wp-includes/classes.php

    old new  
    688688                        $link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp); 
    689689                } 
    690690 
    691                 $_current_category = get_category( $current_category ); 
     691                if ( $current_category ) 
     692                        $_current_category = get_category( $current_category ); 
    692693 
    693694                if ( 'list' == $args['style'] ) { 
    694695                        $output .= "\t<li"; 
    695                         if ( ($category->cat_ID == $current_category) && is_category() ) 
     696                        if ( $current_category && ($category->cat_ID == $current_category) ) 
    696697                                $output .=  ' class="current-cat"'; 
    697                         elseif ( ($category->cat_ID == $_current_category->category_parent) && is_category() ) 
     698                        elseif ( $_current_category && ($category->cat_ID == $_current_category->category_parent) ) 
    698699                                $output .=  ' class="current-cat-parent"'; 
    699700                        $output .= ">$link\n"; 
    700701                } else {