Changeset 4580

Show
Ignore:
Timestamp:
12/01/06 18:55:27 (2 years ago)
Author:
ryan
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-includes/category-template.php

    r4524 r4580  
    239239    } else { 
    240240        global $wp_query; 
    241         $r['current_category'] = $wp_query->get_queried_object_id(); 
     241         
     242        if ( is_category() ) 
     243            $r['current_category'] = $wp_query->get_queried_object_id(); 
     244 
    242245        if ( $hierarchical ) 
    243246            $depth = 0;  // Walk the full depth. 
  • trunk/wp-includes/classes.php

    r4579 r4580  
    620620        } 
    621621 
    622         $_current_category = get_category( $current_category ); 
     622        if ( $current_category ) 
     623            $_current_category = get_category( $current_category ); 
    623624 
    624625        if ( 'list' == $args['style'] ) { 
    625626            $output .= "\t<li"; 
    626             if ( ($category->cat_ID == $current_category) && is_category() ) 
     627            if ( $current_category && ($category->cat_ID == $current_category) ) 
    627628                $output .=  ' class="current-cat"'; 
    628             elseif ( ($category->cat_ID == $_current_category->category_parent) && is_category() ) 
     629            elseif ( $_current_category && ($category->cat_ID == $_current_category->category_parent) ) 
    629630                $output .=  ' class="current-cat-parent"'; 
    630631            $output .= ">$link\n";