WordPress.org

Support

Support » Multisite » Sharing widget areas between blogs – is this possible?

Sharing widget areas between blogs – is this possible?

  • fizzyfozzy
    Member

    @fizzyfozzy

    I have a multisite installation and on the top-level site have created a widget area called menu-bar – within which I am using the
    JQuery Mega Menu Widget to display a multi-level nav bar.
    I’d like to share this nav bar across all my sub-sites so after reading a few support articles on here tried this code:

    //Add menu bar area
    function add_menubar_area() {
    	?><div style="clear:both"></div><?php
    	switch_to_blog(1);
    	if (is_sidebar_active('menubar-area')) {
    		echo thematic_before_widget_area('menubar-area');
    		dynamic_sidebar('menubar-area');
    		echo thematic_after_widget_area('menubar-area');
    	}
    	restore_current_blog();
    }
    add_action('thematic_belowheader','add_menubar_area');

    But it’s not working, the mega menus nav bar doesn’t show in my sub-site.

    Can anyone help me out?

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Try something simpler.

    Remove the if statement with just a simple echo of the blog 1’s name. See if that comes through.

    fizzyfozzy
    Member

    @fizzyfozzy

    Hi, thanks.

    I tried without the if statement and the widget area is showing up there in the code but not the contents of it from the top-level blog.

    I have got around displaying the JQuery Mega Menu Widget in another round-about way now – see my thread here: http://wordpress.org/support/topic/plugin-jquery-mega-menu-widget-multisite-question?replies=2

    But I’d love to know if it’s possible to just share the content of a widget area on the top-level within the sub-domains.

    but not the contents of it from the top-level blog.

    Don’t run before you walk 😉

    Step 1) Did you make the widget area right (you did!)

    Step 2) see if you can echo the blog.

    switch_to_blog(1);
    echo get_current_blog_id();

    If that echos 1, then you’re okay. If NOT, then we know where it’s failing 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sharing widget areas between blogs – is this possible?’ is closed to new replies.