Answers for "wp navwalker to add icon"

0

wp navwalker to add icon

/*
*
* Walker for the main menu 
*
*/
add_filter( 'walker_nav_menu_start_el', 'add_arrow',10,4);
function add_arrow( $output, $item, $depth, $args ){

//Only add class to 'top level' items on the 'primary' menu.
if('primary' == $args->theme_location && $depth === 0 ){
    if (in_array("menu-item-has-children", $item->classes)) {
        $output .='<span class="sub-menu-toggle"></span>';
    }
}
    return $output;
}
Posted by: Guest on August-02-2021

Browse Popular Code Answers by Language