From ec850c84789c5cc3356c51c597f922a6ce733847 Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 1 Dec 2006 12:05:21 +0000 Subject: [PATCH] Give CSS class to parent of current page/cat. Props mdawaffe. fixes #3253 git-svn-id: http://svn.automattic.com/wordpress/trunk@4576 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/classes.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/wp-includes/classes.php b/wp-includes/classes.php index b55d8ef976..f60b50d8bf 100644 --- a/wp-includes/classes.php +++ b/wp-includes/classes.php @@ -503,8 +503,11 @@ class Walker_Page extends Walker { $indent = str_repeat("\t", $depth); $css_class = 'page_item'; + $_current_page = get_page( $current_page ); if ( $page->ID == $current_page ) $css_class .= ' current_page_item'; + elseif ( $_current_page && $page->ID == $_current_page->post_parent ) + $css_class .= ' current_page_parent'; $output .= $indent . '
  • ' . $page->post_title . ''; @@ -612,11 +615,15 @@ class Walker_Category extends Walker { if ( isset($show_date) && $show_date ) { $link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp); } - + + $_current_category = get_category( $current_category ); + if ( 'list' == $args['style'] ) { $output .= "\tcat_ID == $current_category) && is_category() ) $output .= ' class="current-cat"'; + elseif ( ($category->cat_ID == $_current_category->category_parent) && is_category() ) + $output .= ' class="current-cat-parent"'; $output .= ">$link\n"; } else { $output .= "\t$link
    \n";