Make WordPress Core

Ticket #12812: notice-and-styling-frontend-menus.12812.diff

File notice-and-styling-frontend-menus.12812.diff, 2.2 KB (added by filosofo, 15 years ago)
  • wp-includes/nav-menu-template.php

     
    8181                                // Back compat classes for pages to match wp_page_menu()
    8282                                $classes[] = 'page_item';
    8383                                $classes[] = 'page-item-' . $item->object_id;
    84                                 if ( !empty($item->classes) ) {
     84                                if ( ! empty( $item->classes ) ) {
    8585                                        if ( in_array('current-menu-item', $classes) )
    8686                                                $classes[] = 'current_page_item';
    8787                                        if ( in_array('current-menu-parent', $classes) )
     
    361361
    362362        // set parent's class
    363363        foreach ( (array) $menu_items as $key => $parent_item ) {
    364                 if ( 'post_type' == $parent_item->type && is_post_type_hierarchical( $queried_object->post_type ) && in_array( $parent_item->object_id, $queried_object->ancestors ) )
    365                         $menu_items[$key]->classes = trim( $parent_item->classes . ' ' . 'current-' . $queried_object->post_type . '-ancestor' );
     364                if (
     365                        isset( $parent_item->type ) &&
     366                        'post_type' == $parent_item->type &&
     367                        ! empty( $queried_object->post_type ) &&
     368                        is_post_type_hierarchical( $queried_object->post_type ) &&
     369                        in_array( $parent_item->object_id, $queried_object->ancestors )
     370                )
     371                        $menu_items[$key]->classes = trim( $parent_item->classes . ' ' . 'current-' . $queried_object->post_type . '-ancestor current-menu-ancestor' );
    366372                if ( in_array( $parent_item->db_id, $active_parent_item_ids ) )
    367373                        $menu_items[$key]->classes = trim( $parent_item->classes . ' ' . 'current-menu-parent' );
    368374                if ( in_array( $parent_item->object_id, $active_parent_object_ids ) )
  • wp-content/themes/twentyten/style.css

     
    431431        display:block;
    432432}
    433433#access ul li.current_page_item a ,
    434 #access ul li.current-menu-item a {
     434#access ul li.current-menu-ancestor a,
     435#access ul li.current-menu-item a,
     436#access ul li.current-menu-parent a {
    435437        color: #fff;
    436438}
    437439
     
    13401342        .home .sticky {
    13411343                border: none;
    13421344        }
    1343 }
    1344  No newline at end of file
     1345}