Make WordPress Core


Ignore:
Timestamp:
12/18/2015 06:37:41 PM (9 years ago)
Author:
boonebgorges
Message:

Add current-cat-ancestor class to ancestor items in wp_list_categories().

Pairs nicely with current-cat-parent.

Props jrchamp, swisssipdy, ardathksheyna, wonderboymusic.
Fixes #10676.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-walker-category.php

    r35140 r36008  
    171171                        $css_classes[] = 'current-cat-parent';
    172172                    }
     173                    while ( $_current_term->parent ) {
     174                        if ( $category->term_id == $_current_term->parent ) {
     175                            $css_classes[] =  'current-cat-ancestor';
     176                            break;
     177                        }
     178                        $_current_term = get_term( $_current_term->parent, $category->taxonomy );
     179                    }
    173180                }
    174181            }
Note: See TracChangeset for help on using the changeset viewer.