mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@54801 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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 ];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user