Skip to content

Instantly share code, notes, and snippets.

@jg314
Created January 5, 2015 20:58
Show Gist options
  • Save jg314/d197faa651451fad745d to your computer and use it in GitHub Desktop.
Save jg314/d197faa651451fad745d to your computer and use it in GitHub Desktop.
WordPress: Add secondary navigation to end of primary navigation in PHP for mobile.
<div class="main-navigation-container">
<nav id="site-navigation" class="main-navigation navigation" role="navigation">
<?php
$secondary_nav = wp_nav_menu( array(
'theme_location' => 'secondary',
'echo' => false,
'items_wrap' => '%3$s',
'container' => false
) );
//Add $secondary_nav to end so we can include it in our mobile navigation
wp_nav_menu( array(
'theme_location' => 'primary',
'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s' . $secondary_nav . '</ul>',
) ); ?>
</nav><!-- #site-navigation -->
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment