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: https://develop.svn.wordpress.org/trunk@16742 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith 2010-12-06 03:54:57 +00:00
parent 67ca818f87
commit f2702dd794
1 changed files with 7 additions and 1 deletions

View File

@ -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() )