WordPress.org

Make WordPress Core

Ticket #35272: 35272.2.diff

File 35272.2.diff, 1.3 KB (added by adamsilverstein, 3 years ago)
  • src/wp-includes/nav-menu-template.php

     
    334334        $possible_object_parents = array_filter( $possible_object_parents );
    335335
    336336        $front_page_url = home_url();
     337        $front_page_id  = get_option( 'page_on_front' );
    337338
    338339        foreach ( (array) $menu_items as $key => $menu_item ) {
    339340
     
    344345                $classes[] = 'menu-item-type-' . $menu_item->type;
    345346                $classes[] = 'menu-item-object-' . $menu_item->object;
    346347
     348                // This menu item is set as the 'Front Page'.
     349                if ( $front_page_id === $menu_item->object_id ) {
     350                        $classes[] = 'menu-item-home';
     351                }
     352
    347353                // if the menu item corresponds to a taxonomy term for the currently-queried non-hierarchical post object
    348354                if ( $wp_query->is_singular && 'taxonomy' == $menu_item->type && in_array( $menu_item->object_id, $possible_object_parents ) ) {
    349355                        $active_parent_object_ids[] = (int) $menu_item->object_id;
     
    377383                                $classes[] = 'current_page_item';
    378384                        }
    379385
    380                         if ( 'page_on_front' ) {
    381                                 $classes[] = 'menu-item-home';
    382                         }
    383 
    384386                        $active_parent_item_ids[] = (int) $menu_item->menu_item_parent;
    385387                        $active_parent_object_ids[] = (int) $menu_item->post_parent;
    386388                        $active_object = $menu_item->object;