REFACTORING walker behaviour into specific dedicated filme
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
70f53cea2b
commit
2ae40153fc
|
|
@ -47,33 +47,6 @@ add_action('after_setup_theme', 'carhop_setup');
|
|||
|
||||
|
||||
|
||||
// ##### Menu Walker
|
||||
// if (!function_exists('register_navwalker')) :
|
||||
// function register_navwalker() {
|
||||
// require('includes/navwalker.php');
|
||||
// }
|
||||
// endif;
|
||||
// add_action('after_setup_theme', 'register_navwalker');
|
||||
|
||||
|
||||
|
||||
|
||||
// ##### Walker to ReWrap li submenu parent with button instead of <a>
|
||||
function wrap_parent_menu_item_buttons($output, $item, $depth, $args)
|
||||
{
|
||||
|
||||
if ($args->theme_location === "primary" && 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>';
|
||||
}
|
||||
if ($args->theme_location === "footer" && in_array('menu-item-has-children', $item->classes, true)) {
|
||||
$output = $item->title;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
add_filter('walker_nav_menu_start_el', 'wrap_parent_menu_item_buttons', 10, 4);
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
##### Enqueue Theme assets 🡒 Front
|
||||
------------------------------------------------------------------*/
|
||||
|
|
@ -141,44 +114,3 @@ function tailpress_asset($path)
|
|||
|
||||
return add_query_arg('time', time(), get_stylesheet_directory_uri() . '/' . $path);
|
||||
}
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
##### Adds option 'li_class' to 'wp_nav_menu
|
||||
------------------------------------------------------------------*/
|
||||
|
||||
function tailpress_nav_menu_add_li_class($classes, $item, $args, $depth)
|
||||
{
|
||||
if (isset($args->li_class)) {
|
||||
$classes[] = $args->li_class;
|
||||
}
|
||||
|
||||
if (isset($args->{"li_class_$depth"})) {
|
||||
$classes[] = $args->{"li_class_$depth"};
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
||||
|
||||
add_filter('nav_menu_css_class', 'tailpress_nav_menu_add_li_class', 10, 4);
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
##### Adds option 'submenu_class' to 'wp_nav_menu'
|
||||
------------------------------------------------------------------*/
|
||||
|
||||
function tailpress_nav_menu_add_submenu_class($classes, $args, $depth)
|
||||
{
|
||||
if (isset($args->submenu_class)) {
|
||||
$classes[] = $args->submenu_class;
|
||||
}
|
||||
|
||||
if (isset($args->{"submenu_class_$depth"})) {
|
||||
$classes[] = $args->{"submenu_class_$depth"};
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
||||
|
||||
add_filter('nav_menu_submenu_css_class', 'tailpress_nav_menu_add_submenu_class', 10, 3);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user