Add span in top menu item with nested itens
You can use the walker_nav_menu_start_el filter: add_filter( ‘walker_nav_menu_start_el’, ‘wpse_add_arrow’,10,4); function wpse_add_arrow( $item_output, $item, $depth, $args ){ //Only add class to ‘top level’ items on the ‘primary’ menu. if(‘primary’ == $args->theme_location && $depth ==0){ $item_output .='<span class=”arrow”></span>’; } return $item_output; } This assumes that you’re using wp_nav_menu( array( ‘theme_location’ => ‘primary’) ); to display the menu. … Read more