Add global menu using network-wide-menu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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' ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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