Menus: Add the menu-item-home class to the static front page.

When a site is using a static front page, and that page is in a menu, it isn't given the CSS class `menu-item-home`, contrary to the developer documentation.

Props christophherr.
Fixes #35272.



git-svn-id: https://develop.svn.wordpress.org/trunk@38882 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast 2016-10-24 00:31:21 +00:00
parent 1574d89dfb
commit 1377523033

View File

@ -376,6 +376,11 @@ function _wp_menu_item_classes_by_context( &$menu_items ) {
$classes[] = 'page-item-' . $menu_item->object_id;
$classes[] = 'current_page_item';
}
if ( 'page_on_front' ) {
$classes[] = 'menu-item-home';
}
$active_parent_item_ids[] = (int) $menu_item->menu_item_parent;
$active_parent_object_ids[] = (int) $menu_item->post_parent;
$active_object = $menu_item->object;