Give CSS class to parent of current page/cat. Props mdawaffe. fixes #3253
git-svn-id: https://develop.svn.wordpress.org/trunk@4576 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
731c24fd82
commit
9329aef5cd
@ -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 . '<li class="' . $css_class . '"><a href="' . get_page_link($page->ID) . '" title="' . wp_specialchars($page->post_title, 1) . '">' . $page->post_title . '</a>';
|
||||
|
||||
@ -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 .= "\t<li";
|
||||
if ( ($category->cat_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<br />\n";
|
||||
|
Loading…
Reference in New Issue
Block a user