WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/25/2010 09:44:34 PM (11 years ago)
Author:
ryan
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/nav-menu-template.php

    r14900 r14905  
    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';
     
    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' );
Note: See TracChangeset for help on using the changeset viewer.