WordPress.org

Make WordPress Core

Ticket #13543: add-current-class-to-static-home-page.13543.diff

File add-current-class-to-static-home-page.13543.diff, 1.0 KB (added by filosofo, 4 years ago)
  • wp-includes/nav-menu-template.php

     
    306306        $active_parent_item_ids = array(); 
    307307        $active_parent_object_ids = array(); 
    308308        $possible_object_parents = array(); 
     309        $home_page_id = (int) get_option( 'page_for_posts' ); 
    309310         
    310311        if ( $wp_query->is_singular && ! empty( $queried_object->post_type ) && ! is_post_type_hierarchical( $queried_object->post_type ) ) { 
    311312                foreach ( (array) get_object_taxonomies( $queried_object->post_type ) as $taxonomy ) { 
     
    332333                } elseif ( 
    333334                        $menu_item->object_id == $queried_object_id && 
    334335                        (  
     336                                ( ! empty( $home_page_id ) && 'post_type' == $menu_item->type && $wp_query->is_home && $home_page_id = $menu_item->object_id ) || 
    335337                                ( 'post_type' == $menu_item->type && $wp_query->is_singular ) || 
    336338                                ( 'taxonomy' == $menu_item->type && ( $wp_query->is_category || $wp_query->is_tag || $wp_query->is_tax ) )  
    337339                        )