Adding a Global Menu for a Multisite installation
-
I’m creating a multisite installation for a school where each teacher has their own blog. I want to maintain a unified design including the same menu on each blog. I’ve scoured the web and finally found one way to do this that actually works.
//store the current blog_id being viewed 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 wp_nav_menu( //add your arguments here ); //switch back to the current blog being viewed switch_to_blog($current_blog_id);Placing this code in the header of the child theme I’m using for the teacher pages causes them to grab the header from the main site. Where it says “add your arguments” I simply placed the existing wp_nav_menu. This seems to be working great, but I’m wondering if there is any other way of doing this?
-
You don’t want to rely too much on switch_to_blog, as it’s fairly intensive on your server :/
I’d do this: http://wpmututorials.com/plugins/networkwide-menu/
I had read about (and experienced) the server lag caused by switch_to_blog so I wasn’t excited about using it. I just hadn’t found any functioning alternative.
However, the plugin from WPMU Tutorials works perfectly! Thank you for that link!
Hello,
Do you have an idea where I could find that plugin ? i have tried everything and I do not find it.
Thanks.It’s on the link that Ipstenu posted, just above the heading “Customizing for your use”.
I am trying to use the WPMU plugin! I am following all the steps on the tutorial and am not seeing the menu on my multisites….. any tips on what I might be doing wrong??
Ok, did some more searching and found this! http://ww.wp.xz.cn/support/topic/same-nav-menu-across-all-sites?replies=14
Just had to repeat the process a couple of times and it worked.
The topic ‘Adding a Global Menu for a Multisite installation’ is closed to new replies.