From 1377523033b142ea833ebf5c17c0e4ab2c015118 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Mon, 24 Oct 2016 00:31:21 +0000 Subject: [PATCH] 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 --- src/wp-includes/nav-menu-template.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wp-includes/nav-menu-template.php b/src/wp-includes/nav-menu-template.php index e2c26411c8..de37cb3451 100644 --- a/src/wp-includes/nav-menu-template.php +++ b/src/wp-includes/nav-menu-template.php @@ -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;