WordPress.org

Forums

[resolved] [Feedback] WordPress Menu/widgets Multisite (13 posts)

  1. MyrddinDE
    Member
    Posted 4 years ago #

    Hello,

    I am running a Multisite (mmo-game.eu) and sometimes I need to change the Menu and it is an annoying task to have to do that for all sites in the Network.
    The same is true for widgets. If you want to change a text at the sidebar you have to do it per domain.

    I'd love an option that reads like:
    [ ] use Menu called [......] from Blog [ ] (ID]
    [ ] use Widgets from Blog [ ] (ID]

    Or an option to sync menus/widgets.

    Haven't seen a plugin that can do it. Copied widget settings with "YD Network-wide options" don't work with custom widgets and menus don't work at all sadly.

    This sounds like a "simple" suggestion with a lot of benefit for people like me who are constantly tweaking their site.

    Thanks for reading.

    Michael

  2. Well. Yes.

    Multisite = Multiple, separate, sites. Look at WordPress.com.

    The sites are intended to be 100% separate, save using the same DB and having access to the same user base.

  3. MyrddinDE
    Member
    Posted 4 years ago #

    Well, if you have the same user base, why not enable the same menu? :D

    Its if you like the branding of subsites, etc. Not like multiple separated blogs are the only use for that. I am using it to separate subjects for my visitors ... for example to have wow users not get useless posts about skyrim or wildstar, mass effect or witcher ...
    the same things you mentioned are true for that ... common user database, ease of adminsitration, plugins, themes ... so I don't get why it is not intended to make it possible to take this one step further. Not like people HAVE to use the option, just like I prefer to have my sites, while separate still as one site.

    But thanks for the reply.

  4. Because the sites are separate. I totally get what you're saying, and I'm just explaining the design :)

    Anyway: http://wpmututorials.com/plugins/networkwide-menu/

    Its if you like the branding of subsites, etc. Not like multiple separated blogs are the only use for that. I am using it to separate subjects for my visitors

    I ... wouldn't use Multisite for it. Custom Post types, maybe.

  5. MyrddinDE
    Member
    Posted 4 years ago #

    Yeah, I have some custom blogs by others there, too. I also get what you are saying, about keeping things separate and can understand where you draw the border.

    I have been searching for Network menus for a while and always grew frustrated finding no solutions, just others who were looking for the same.

    The link you showed always eluded my search :D Thanks, appreciate the help!

    kind regards,

    Michael

  6. MyrddinDE
    Member
    Posted 4 years ago #

    Ah well, have the same issue as the commenters on the site. Followed the instructions, but see no effect.

    Can just hope that someone takes more than 15 min into coding this option and doesn't get grumpy when people don't understand the instructions :D

  7. CGAdmin
    Member
    Posted 4 years ago #

    I've been messing with this sort of issue for pretty much the whole day and I think I have figured out how to create a basic menu for each "child" site based on one "master" menu on the main site (or even any other site you choose to place it).

    It might take us a bit of hashing to get it to work right because I am in the infancy of the operation, but I'm pleased with my results so far.

    The key is to utilize the same underlying theme for all sites (which it appears you are doing to "brand" the child sites as I am). I personally like to use two custom menus: public-menu and user-menu. Obviously one is for logged in users and the other is for anonymous users.

    What we need to do is tell each child site where to look as it builds its menu structure. I'm sure you have discovered that even if you name all the menus on each child site the same, it creates its own instance of that menu (which defaults to blank). As a caveat, I have been messing around with changing the default structure of the menus as well, but haven't had much luck.

    Anyway, in the header when you call your custom menu, add a switch_to_blog call in before you load the menu. This will make the server call up the same menu on all child sites. The unfortunate part is that the user then is unable to add new menu options or make changes. I'm still working on that part. The cool part is that the child sites aren't required to have any menus defined at all.

    Here is the code I have in my header:

    <?php if (is_user_logged_in()) {
    	switch_to_blog(1);
    	wp_nav_menu(array(
    		'echo' => true,
    		'theme_location' => 'user-menu',
    		'container_class' => 'nav-center'
    	));
    	restore_current_blog();
    } else {
    	switch_to_blog(1);
    	wp_nav_menu(array(
    		'echo' => true,
    		'theme_location' => 'public-menu',
    		'container_class' => 'nav-center'
    	));
    	restore_current_blog();
    } ?>

    Does this help?

  8. MyrddinDE
    Member
    Posted 4 years ago #

    Yes thanks, I tried this long ago, but did not find the cortect spot, where to change this in my Artisteer generated Theme.

    But here is what I ended up doing, pretty similar to what you said above.

    I copied the original theme to a new folder, edited the style.css to give the theme a new name and below instructions into the header.php (I tried thsi initiall in the menu php)

    mmo85 -> mmo85nm
    edit style.css
    edit header.php

    Credit goes to Abland at Artisteer Forums

    global $blog_id;
    $current_blog_id = $blog_id;
    switch_to_blog(1);
    
    echo theme_get_menu(array(
    'source' => theme_get_option('theme_menu_source'),
    'depth' => theme_get_option('theme_menu_depth'),
    'menu' => 'primary-menu',
    'class' => 'art-hmenu'
    )
    );
    switch_to_blog($current_blog_id);

    This way I can have the old style and also a network version for select sites.

    Works like a charm now!

    http://www.mmo-game.eu/ <- Main Site
    http://www.myrddin.de/ <- Subsite with network Menu (Domain Mapping)
    http://album.mmo-game.eu/ <- Subsite with network Menu

  9. CGAdmin
    Member
    Posted 4 years ago #

    Good looking sites.

    You can change your code to the following and get the same function if you care about keeping your code as short as possible:

    switch_to_blog(1);
    
    echo theme_get_menu(array(
    'source' => theme_get_option('theme_menu_source'),
    'depth' => theme_get_option('theme_menu_depth'),
    'menu' => 'primary-menu',
    'class' => 'art-hmenu'
    ));
    
    restore_current_blog();
  10. MyrddinDE
    Member
    Posted 4 years ago #

    Thanks for the feedback.

    I'll look into it :-)

  11. lovemegood
    Member
    Posted 3 years ago #

    Are you placing this code in the main site theme or in your first multisite created site theme?

  12. MyrddinDE
    Member
    Posted 3 years ago #

    I have 2 themes, 1 for sites that use the network menu and one for the ones that don't.

    The child site theme needs to have the switch code. The code does instead of reading the menu from the current blog switch to the blog with id 1 and reads the menu then switches back for the content to the current site.

  13. lovemegood
    Member
    Posted 3 years ago #

    I was able to do te menu without hardcoding. I just duplicated the mainsite database with the appropriate "wp_#_" for the following databases using the find replace on text edit on mac:

    wp_commentmeta
    wp_comments
    wp_links
    wp_options
    wp_postmeta
    w_posts
    wp_terms
    wp_term_relationships
    wp_term_taxonomy

    This dup'ed all my post, menu, categories, etc. But Now I want an easy way to duplicate my widgets, a hardcode I guess.
    Each new site I create is in a different langauage. Same site, just translated.

Topic Closed

This topic has been closed to new replies.

About this Topic