Skip to content

Instantly share code, notes, and snippets.

@alexwcoleman
Last active November 7, 2016 23:44
Show Gist options
  • Save alexwcoleman/a3de0a28ede90fa94f8334a809d35ca1 to your computer and use it in GitHub Desktop.
Save alexwcoleman/a3de0a28ede90fa94f8334a809d35ca1 to your computer and use it in GitHub Desktop.
Combining two WordPress menus into one
<?php
// two WordPress menus combined into one.
// first menu.
$menu = wp_nav_menu( array(
'theme_location'=> 'secondary', // or whatever location
'fallback_cb' => false,
'container' => '',
'items_wrap' => '%3$s',
'echo' => false
) );
// include all of the menu items from the first inside the second menu.
wp_nav_menu( array(
'theme_location' => 'primary', // or whatever location
'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