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, peterwilsoncc. Merges [54801] to the 6.1 branch. Fixes #56946. See #28620. Built from https://develop.svn.wordpress.org/branches/6.1@54809 git-svn-id: http://core.svn.wordpress.org/branches/6.1@54361 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d8cd75854d
commit
93cac07625
|
@ -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 ];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.1.1-alpha-54808';
|
||||
$wp_version = '6.1.1-alpha-54809';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue