3

I'm looking into a way to have global menus across my network of blogs. Basically I am using wordpress as a CMS - the purpose of the network is actually to ringfence content. The sub blogs will be able to customise some areas of the template - but I would like them to share the main site's menu system.

This is easy enough for a static consistant menu - but my clients would like to be able to make changes to the menu on the main, top-level site using wordpress' built in custom menu system.

So - in short, can my sub sites in a blog network show the custom menu from my top level site?

Thanks

3 Answers 3

4

That's an old question, if someone like me landed on this page for WORDPRESS MULTISITE MENU sharing across all network sites without any plugin,

Not only menu you can use the same method to share anything other then widgets across all the network sites.

here is the solution : Edit your Header.php

//store the current blog_id - Use this function at the start of the function that you want to share

global $blog_id;
$current_blog_id = $blog_id;

//switch to the main blog which will have an id of 1
switch_to_blog(1);

//output the WordPress navigation menu - incase of menu-sharing use this

wp_nav_menu( 
   //add your arguments here
);

//switch back to the current blog being viewed - before ending of the function

switch_to_blog($current_blog_id); 
5
  • 1
    Wow a blast from the past. I wouldn't have accepted the original answer any more. This seems like a good answer - not able to test it. Sep 18, 2017 at 14:14
  • 2
    @JorgeLuisBorges i tested it before writing here, if you got a chance you can test it by yourself, Cheers Sep 19, 2017 at 15:28
  • 1
    @MuhammadAbdullah, i was looking for something without any plugin dependencies, can't trust enough to an external code, Thanks for sharing
    – Nestsouls
    Sep 19, 2017 at 15:33
  • 1
    @JorgeLuisBorges, You can mark multiple answers as accepted, this works for me, made my day :-)
    – Nestsouls
    Sep 19, 2017 at 15:36
  • 1
    Great simple solution. A note for others who find this: the network sites need to have a menu with the appropriate location enabled (it can just be an empty one) for this to work. Your mileage may vary, but that was the trick that got it to work for me, applying this as a child theme modification on the twentyseventeen theme.
    – robmathers
    Oct 24, 2018 at 19:52
2

Try this plugin Network Wide Menu by Ron Rennick. It does exactly what it says: "Implements a network wide menu using a menu in the main site of your network".

I tested in WPMU 3.3.1 and it works. Network Activate the plugin or drop the script "ra-network-wide-menu.php" directly in the /mu-plugins/ folder. Follow the tutorial from the plugin page.

0

This is similar to something I'm thinking of doing for one of my sites... I haven't implemented the idea yet but I was thinking of writing some PHP code to CURL my main website and parse the returned page for its menu content and use that parsed content as part of my sub-site's menu. CURL is pretty fast so it shouldn't impose too big of a drag on the rendering of the sub-site.

Like I said, I haven't tried it yet so the concept might end up being a lame horse.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.