From 9a2189e8808494443a3114c0961b68cb4b7a1203 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Fri, 11 Nov 2022 00:06:14 +0000 Subject: [PATCH] Menus: Apply `menu-item-has-children` class in sub-menus. Ensure the `menu-item-has-children` class is added to sub-menu items when `wp_nav_menu()` is called with the `depth` parameter specified to a non-zero value. Follow up to [54478]. Props davidvongries, fpodhorsky, hellofromTonya, innovext, larsmqller, LeonidasMilossis, mattkeys, mukesh27, nuvoPoint, ocean90, outrankjames, petitphp, SergeyBiryukov, sippis, webmandesign. Fixes #56946. See #28620. Built from https://develop.svn.wordpress.org/trunk@54801 git-svn-id: http://core.svn.wordpress.org/trunk@54353 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/nav-menu-template.php | 14 +++++++------- wp-includes/version.php | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/wp-includes/nav-menu-template.php b/wp-includes/nav-menu-template.php index df478a5fa4..0673bf36ed 100644 --- a/wp-includes/nav-menu-template.php +++ b/wp-includes/nav-menu-template.php @@ -204,14 +204,14 @@ function wp_nav_menu( $args = array() ) { if ( $menu_item->menu_item_parent ) { $menu_items_with_children[ $menu_item->menu_item_parent ] = 1; } + } - // Calculate the depth of each menu item with children - foreach ( $menu_items_with_children as $menu_item_key => &$menu_item_depth ) { - $menu_item_parent = $menu_items_tree[ $menu_item_key ]; - while ( $menu_item_parent ) { - $menu_item_depth = $menu_item_depth + 1; - $menu_item_parent = $menu_items_tree[ $menu_item_parent ]; - } + // Calculate the depth of each menu item with children. + foreach ( $menu_items_with_children as $menu_item_key => &$menu_item_depth ) { + $menu_item_parent = $menu_items_tree[ $menu_item_key ]; + while ( $menu_item_parent ) { + $menu_item_depth = $menu_item_depth + 1; + $menu_item_parent = $menu_items_tree[ $menu_item_parent ]; } } diff --git a/wp-includes/version.php b/wp-includes/version.php index 16d3aa9116..db2a2a9a8d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.2-alpha-54799'; +$wp_version = '6.2-alpha-54801'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.