Is there a way to combine multiple menus in the functions.php file using wp_nav_menu_items()? I need to hook in a second menu to the main menu. The site has two separate menus in the header. One is a drop down and the other is a hamburger. When on mobile the drop down is no good. I need to add the items from the drop down menu (menu 2) to the main menu (hamburger).
below is my current setup. As you can see I am already adding in social and company info to the menu. Now I need to add a second menu.
function add_social_to_wp_menu ( $items, $args ) {
if ( 'on' === et_get_option( 'divi_show_facebook_icon', 'on' ) ) :
$social_icons .= '<span class="et-social-icon et-social-facebook">
<a href="'.esc_url( et_get_option( 'divi_facebook_url', '#' ) ).'" class="icon">
</a>
</span>';
endif;
if ( 'on' === et_get_option( 'divi_show_twitter_icon', 'on' ) ) :
$social_icons .= '<span class="et-social-icon et-social-twitter">
<a href="'.esc_url( et_get_option( 'divi_twitter_url', '#' ) ).'" class="icon">
</a>
</span>';
endif;
if ( 'on' === et_get_option( 'divi_show_google_icon', 'on' ) ) :
$social_icons .= '<span class="et-social-icon et-social-google-plus">
<a href="'.esc_url( et_get_option( 'divi_google_url', '#' ) ).'" class="icon">
</a>
</span>';
endif;
if ( 'on' === et_get_option( 'divi_show_instagram_icon', 'on' ) ) :
$social_icons .= '<span class="et-social-icon et-social-instagram">
<a href="'.esc_url( et_get_option( 'divi_instagram_url', '#' ) ).'" class="icon">
</a>
</span>';
endif;
if ( 'on' === et_get_option( 'divi_show_youtube_icon', 'on' ) ) :
$social_icons .= '<span class="et-social-icon et-social-youtube">
<a href="'.esc_url( et_get_option( 'divi_youtube_url', '#' ) ).'" class="icon">
</a>
</span>';
endif;
if ( 'on' === et_get_option( 'divi_show_rss_icon', 'on' ) ) :
$et_rss_url = '' !== et_get_option( 'divi_rss_url' )
? et_get_option( 'divi_rss_url' )
: get_bloginfo( 'rss2_url' );
$social_icons .= '<span class="menu-item et-social-icon et-social-rss">
<a href="'.esc_url( $et_rss_url ).'" class="icon">
</a>
</span>';
endif;
if( 'main-menu' === $args -> menu ) {
$items .= '<li class="menu-item company-info">'.do_shortcode('[show-company-info]').'</li>';
$items .= '<li class="menu-item social-networks">'.$social_icons.'</li>';
}
return $items;
}
add_filter('wp_nav_menu_items','add_social_to_wp_menu',10,2);