mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-22 06:29:30 +00:00
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
This commit is contained in:
parent
0bcce8aad3
commit
ec850c8478
@ -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…
x
Reference in New Issue
Block a user