I want to add some items to the right of a menu in my Genesis child theme, but I want to add and change them using functions.php. (Network subsites use this theme and I want to change the menu on all subsites without editing each subsite.)
Here is the code I've added to the theme's functions.php:
//* Custom primary menu */
function menu_extras($menu, $args) {
if( 'primary' !== $args->theme_location )
return $menu;
return $menu . '<li class="right"><a href="/item1/">Item 1</a></li> <li class="right"><a href="/item2/">Item 2</a></li> <li class="right"><a href="/item3/">Item 3</a></li> <li class="right"><a href="/item4/">Item 4</a></li>';
}
add_filter('wp_nav_menu_items','menu_extras', 10, 2);
This works fine, but I want subitems on some of the menu items. So for instance, mousing over "Item 2" should offer dropdown subitems "Item 2A" and "Item 2B" linked to their respective urls.
In that case, what would replace <li class="right"><a href="/item2/">Item 2</a></li>
in the code above to create the subitems?