Make WordPress Core

Ticket #10676: 10676_short_circuit.diff

File 10676_short_circuit.diff, 822 bytes (added by jrchamp, 11 years ago)
  • wp-includes/category-template.php

    diff --git wp-includes/category-template.php wp-includes/category-template.php
    index 96a61cf..3c5e66f 100644
    class Walker_Category extends Walker { 
    871871                        $class = 'cat-item cat-item-' . $category->term_id;
    872872                        if ( !empty($current_category) ) {
    873873                                $_current_category = get_term( $current_category, $category->taxonomy );
     874                                if ( $hierarchical && $_current_category->parent )
     875                                        $category_ancestors = get_ancestors( $current_category, $category->taxonomy );
     876                                        if ( in_array( $category->term_id, $category_ancestors ) )
     877                                                $class .= ' current-cat-ancestor';
     878                               
    874879                                if ( $category->term_id == $current_category )
    875880                                        $class .=  ' current-cat';
    876881                                elseif ( $category->term_id == $_current_category->parent )