WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/26/2010 02:18:46 PM (10 years ago)
Author:
ryan
Message:

More menu class back compat. Props filosofo. fixes #13543

File:
1 edited

Legend:

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

    r14924 r14942  
    334334            $menu_item->object_id == $queried_object_id &&
    335335            (
    336                 ( ! empty( $home_page_id ) && 'post_type' == $menu_item->type && $wp_query->is_home && $home_page_id = $menu_item->object_id ) ||
     336                ( ! empty( $home_page_id ) && 'post_type' == $menu_item->type && $wp_query->is_home && $home_page_id == $menu_item->object_id ) ||
    337337                ( 'post_type' == $menu_item->type && $wp_query->is_singular ) ||
    338338                ( 'taxonomy' == $menu_item->type && ( $wp_query->is_category || $wp_query->is_tag || $wp_query->is_tax ) )
    339339            )
    340340        ) {
    341             $menu_items[$key]->classes = trim( $menu_item->classes . ' ' . 'current-menu-item' );
     341            $menu_items[$key]->classes = trim( $menu_items[$key]->classes . ' ' . 'current-menu-item' );
    342342            $active_parent_item_ids[] = (int) $menu_item->menu_item_parent;
    343343            $active_parent_object_ids[] = (int) $menu_item->post_parent;
     
    357357            }
    358358        }
     359       
     360        // back-compat with wp_page_menu: add "current_page_parent" to static home page link for any non-page query
     361        if ( ! empty( $home_page_id ) && 'post_type' == $menu_item->type && empty( $wp_query->is_page ) && $home_page_id == $menu_item->object_id )
     362            $menu_items[$key]->classes = trim( $menu_items[$key]->classes . ' ' . 'current_page_parent' );
    359363    }
    360364
Note: See TracChangeset for help on using the changeset viewer.