Skip to content

Instantly share code, notes, and snippets.

@rrennick
Last active July 11, 2016 21:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rrennick/4651331 to your computer and use it in GitHub Desktop.
Save rrennick/4651331 to your computer and use it in GitHub Desktop.
Add global menu using network-wide-menu
<?php
/*
register the menu across the network
*/
register_nav_menu( 'global', 'Global Navigation Menu' );
/*
remove the menu from the menu screen on sub sites to avoid confusing users
*/
add_action( 'admin_init', 'global_nav_menu_init' );
function global_nav_menu_init(){
if ( ! is_main_site() )
unregister_nav_menu( 'global' );
}
<div class="global-nav-menu">
<?php
wp_nav_menu( 'global' );
?>
</div><!-- global-nav-menu -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment