WordPress.org

Forums

[resolved] Adding a Global Menu for a Multisite installation (7 posts)

  1. novacode7
    Member
    Posted 3 years ago #

    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?

  2. 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/

  3. novacode7
    Member
    Posted 3 years ago #

    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!

  4. mouzaia
    Member
    Posted 2 years ago #

    Hello,
    Do you have an idea where I could find that plugin ? i have tried everything and I do not find it.
    Thanks.

  5. novacode7
    Member
    Posted 2 years ago #

    It's on the link that Ipstenu posted, just above the heading "Customizing for your use".

  6. jampafoo
    Member
    Posted 2 years ago #

    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??

  7. jampafoo
    Member
    Posted 2 years ago #

    Ok, did some more searching and found this! http://wordpress.org/support/topic/same-nav-menu-across-all-sites?replies=14
    Just had to repeat the process a couple of times and it worked.

Topic Closed

This topic has been closed to new replies.

About this Topic