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.


Built from https://develop.svn.wordpress.org/trunk@38882


git-svn-id: http://core.svn.wordpress.org/trunk@38825 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast 2016-10-24 00:32:32 +00:00
parent 46bae0275c
commit efaf9bae66
2 changed files with 6 additions and 1 deletions

View File

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

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.7-alpha-38881'; $wp_version = '4.7-alpha-38882';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.