add span to top level links of a wordpress menu called “main”
$args, the second parameter passed to wp_nav_menu_objects can be used to check which menu is being processed. This will allow us to target only the desired menu. In the code below, we check if the slug of the menu is main and if so, wrap the top level menu items in span tags. /** * … Read more