From 31db92d83ee8dc698673af18172d97ebd753cf75 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Fri, 18 Dec 2015 18:38:25 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@36008 git-svn-id: http://core.svn.wordpress.org/trunk@35973 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-walker-category.php | 7 +++++++ wp-includes/version.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/wp-includes/class-walker-category.php b/wp-includes/class-walker-category.php index da518c9ee1..8ef3c58d52 100644 --- a/wp-includes/class-walker-category.php +++ b/wp-includes/class-walker-category.php @@ -170,6 +170,13 @@ class Walker_Category extends Walker { } elseif ( $category->term_id == $_current_term->parent ) { $css_classes[] = 'current-cat-parent'; } + while ( $_current_term->parent ) { + if ( $category->term_id == $_current_term->parent ) { + $css_classes[] = 'current-cat-ancestor'; + break; + } + $_current_term = get_term( $_current_term->parent, $category->taxonomy ); + } } } diff --git a/wp-includes/version.php b/wp-includes/version.php index 71197d3a18..7d2b700e7b 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.5-alpha-36007'; +$wp_version = '4.5-alpha-36008'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.