Skip to content

Instantly share code, notes, and snippets.

@devinsays
Created November 13, 2015 18:09
Show Gist options
  • Save devinsays/bcee062eb97712698a96 to your computer and use it in GitHub Desktop.
Save devinsays/bcee062eb97712698a96 to your computer and use it in GitHub Desktop.
Combines two WordPress menus into one.
<?php
/**
* Combines the markup of two menu areas into one.
*/
// Get the markup list items in the first menu.
$menu = wp_nav_menu( array(
'theme_location'=> 'menu-1',
'fallback_cb' => false,
'container' => '',
'items_wrap' => '%3$s',
'echo' => false
) );
// Display menu-2 with all the list items from menu-1 included.
wp_nav_menu( array(
'theme_location' => 'menu-2',
'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s ' . $menu . '</ul>',
) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment