Menu notice and stlying fixes. Props filosofo. fixes #12812

git-svn-id: http://svn.automattic.com/wordpress/trunk@14905 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-05-25 21:44:34 +00:00
parent 4ec5fd4f13
commit cf3466579b
2 changed files with 13 additions and 5 deletions

View File

@ -431,7 +431,9 @@ div.menu li {
display:block; display:block;
} }
#access ul li.current_page_item a , #access ul li.current_page_item a ,
#access ul li.current-menu-item a { #access ul li.current-menu-ancestor a,
#access ul li.current-menu-item a,
#access ul li.current-menu-parent a {
color: #fff; color: #fff;
} }
@ -1340,4 +1342,4 @@ code {
.home .sticky { .home .sticky {
border: none; border: none;
} }
} }

View File

@ -81,7 +81,7 @@ class Walker_Nav_Menu extends Walker {
// Back compat classes for pages to match wp_page_menu() // Back compat classes for pages to match wp_page_menu()
$classes[] = 'page_item'; $classes[] = 'page_item';
$classes[] = 'page-item-' . $item->object_id; $classes[] = 'page-item-' . $item->object_id;
if ( !empty($item->classes) ) { if ( ! empty( $item->classes ) ) {
if ( in_array('current-menu-item', $classes) ) if ( in_array('current-menu-item', $classes) )
$classes[] = 'current_page_item'; $classes[] = 'current_page_item';
if ( in_array('current-menu-parent', $classes) ) if ( in_array('current-menu-parent', $classes) )
@ -361,8 +361,14 @@ function _wp_menu_item_classes_by_context( &$menu_items = array() ) {
// set parent's class // set parent's class
foreach ( (array) $menu_items as $key => $parent_item ) { foreach ( (array) $menu_items as $key => $parent_item ) {
if ( 'post_type' == $parent_item->type && is_post_type_hierarchical( $queried_object->post_type ) && in_array( $parent_item->object_id, $queried_object->ancestors ) ) if (
$menu_items[$key]->classes = trim( $parent_item->classes . ' ' . 'current-' . $queried_object->post_type . '-ancestor' ); isset( $parent_item->type ) &&
'post_type' == $parent_item->type &&
! empty( $queried_object->post_type ) &&
is_post_type_hierarchical( $queried_object->post_type ) &&
in_array( $parent_item->object_id, $queried_object->ancestors )
)
$menu_items[$key]->classes = trim( $parent_item->classes . ' ' . 'current-' . $queried_object->post_type . '-ancestor current-menu-ancestor' );
if ( in_array( $parent_item->db_id, $active_parent_item_ids ) ) if ( in_array( $parent_item->db_id, $active_parent_item_ids ) )
$menu_items[$key]->classes = trim( $parent_item->classes . ' ' . 'current-menu-parent' ); $menu_items[$key]->classes = trim( $parent_item->classes . ' ' . 'current-menu-parent' );
if ( in_array( $parent_item->object_id, $active_parent_object_ids ) ) if ( in_array( $parent_item->object_id, $active_parent_object_ids ) )