WordPress.org

Ready to get started?Download WordPress

Forums

Sharing widget areas between blogs - is this possible? (4 posts)

  1. fizzyfozzy
    Member
    Posted 1 year ago #

    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.

  2. Try something simpler.

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

  3. fizzyfozzy
    Member
    Posted 1 year ago #

    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.

  4. 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 :)

Topic Closed

This topic has been closed to new replies.

About this Topic