Highlight home page Custom Nav Menu item even when extra query args are present in the URL (only if all other highlights fail). props filosofo. fixes #13994
git-svn-id: http://svn.automattic.com/wordpress/trunk@16742 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5cfe6c81cc
commit
0c10eec60c
|
@ -311,6 +311,8 @@ function _wp_menu_item_classes_by_context( &$menu_items ) {
|
|||
|
||||
$possible_object_parents = array_filter( $possible_object_parents );
|
||||
|
||||
$front_page_url = home_url();
|
||||
|
||||
foreach ( (array) $menu_items as $key => $menu_item ) {
|
||||
|
||||
$menu_items[$key]->current = false;
|
||||
|
@ -381,6 +383,10 @@ function _wp_menu_item_classes_by_context( &$menu_items ) {
|
|||
$active_parent_item_ids[] = (int) $menu_item->menu_item_parent;
|
||||
$active_parent_object_ids[] = (int) $menu_item->post_parent;
|
||||
$active_object = $menu_item->object;
|
||||
|
||||
// give front page item current-menu-item class when extra query arguments involved
|
||||
} elseif ( $item_url == $front_page_url && is_front_page() ) {
|
||||
$classes[] = 'current-menu-item';
|
||||
}
|
||||
|
||||
if ( untrailingslashit($item_url) == home_url() )
|
||||
|
|
Loading…
Reference in New Issue