fixing navwalker warpping for subemnu parent item by fixing global menu class
This commit is contained in:
parent
dac6146923
commit
b2c98482f5
|
|
@ -6,14 +6,13 @@
|
||||||
|
|
||||||
function wrap_parent_menu_item_buttons($output, $item, $depth, $args)
|
function wrap_parent_menu_item_buttons($output, $item, $depth, $args)
|
||||||
{
|
{
|
||||||
|
|
||||||
// #### MENU HOMEGRADE HEADER
|
// #### MENU HOMEGRADE HEADER
|
||||||
if ($args->theme_location === "homegrade" && $args->menu_id === "menu-homegrade-navlist" && in_array('menu-item-has-children', $item->classes, true)) {
|
if ($args->theme_location === "homegrade" && $args->menu_id === "menu-homegrade-navlist" && in_array('menu-item-has-children', $item->classes, true)) {
|
||||||
$output = '<button type="button" class="menu-item__submenu-toggle" aria-expanded="false" aria-controls="sub-menu-' . $item->ID . '">' . $item->title . '</button>';
|
$output = '<button type="button" class="menu-item__submenu-toggle" aria-expanded="false" aria-controls="sub-menu-' . $item->ID . '">' . $item->title . '</button>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// #### MENU HOMEGRADE FOOTER
|
// #### MENU HOMEGRADE FOOTER
|
||||||
if ($args->theme_location === "homegrade" && $args->menu_class === "menu-homegrade-footer" && in_array('menu-item-has-children', $item->classes, true)) {
|
if ($args->theme_location === "homegrade" && $args->menu_class === "menu-homegrade--footer" && in_array('menu-item-has-children', $item->classes, true)) {
|
||||||
$output = '<h6 class="page-group-title">' . $item->title . '</h6>';
|
$output = '<h6 class="page-group-title">' . $item->title . '</h6>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -48,9 +47,9 @@ function wrap_parent_menu_item_buttons($output, $item, $depth, $args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($args->theme_location === "footer" && in_array('menu-item-has-children', $item->classes, true)) {
|
// if ($args->theme_location === "footer" && in_array('menu-item-has-children', $item->classes, true)) {
|
||||||
$output = $item->title;
|
// $output = $item->title;
|
||||||
}
|
// }
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
add_filter('walker_nav_menu_start_el', 'wrap_parent_menu_item_buttons', 10, 4);
|
add_filter('walker_nav_menu_start_el', 'wrap_parent_menu_item_buttons', 10, 4);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user