WordPress Multisite global menu tips: create, display, customize

display it in any place and customize

You’ve created a navigation menu on the main site. Let’s see how to make it work across all websites of the network.

How to make sub-sites which use the same theme inherit navigation menu from the main site?

I’ll use Twenty Seventeen Theme  as an example, but this can be done for any other theme and any other template file as well.
Here is the default  footer.php content

Currently if ( has_nav_menu( 'social' ) ) : is looking for the navigation menu in the current site. To make it look for the menu in the main site all we need to do is to point WordPress to that site. We’ll do that using switch_to_blog(); function.

Make navigation menu displayed on the sub-sites even if they use the theme different from the main site

This is how you can get the navigation menu from the main site displayed in any place of any theme of your network

Just keep in mind this will give you raw menu from database without any styling, you’ll have to add styles to your style.css of the current theme. In case you need the same styling for this navigation menu through all themes in your network, you might consider adding css file to the mu-plugins directory to make load everywhere in your network regardless the theme.

Make the combination of navigation menus from different sites of the network

Actually, you can get navigation menu from any sub-site of the network just replacing 1 with ID of that very blog in switch_to_blog(1); line. You can put them together and make really aggregated navigation menu.

WordPress Multisite global menu is a short way to make a strong connection between sites in your network which may become an effective internal link building tool as well.
WordPress Multisite global menu tips: create, display, customize

Leave a Reply

Your email address will not be published. Required fields are marked *