WordPress.org

Support

Support » Multisite » Same widget on all blogs.

Same widget on all blogs.

  • Regarding this topic here:
    http://mu.wordpress.org/forums/topic/17836

    After all, is it possible to define a sidebar to all blogs using switch_to_blog() and dynamic_sidebar()?

    Some places around tell us to do this way, but nothing happens if I try.
    In the other hand, andrea_r say it’s better to hardcode the feature on the theme’s sidebar.

    Well… I think this last one is less elegant, but I will certainly consider it if it’s not possible to share widgets.

Viewing 4 replies - 1 through 4 (of 4 total)
  • After all, is it possible to define a sidebar to all blogs using switch_to_blog() and dynamic_sidebar()?

    Possible, yes. efficient, no. 🙂

    switch_to_blog is an expensive query and gets worse the more sites you have.

    the sites were designed by nature to be separate, so that’s why global management isn’t there for things like this.

    Yah, For some reason this doesn’t work?

    <?php switch_to_blog(1);
    if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('1') ) : endif;
    restore_current_blog(); ?>

    Can anyone explain why this is? I only have two sites that i want to share the main site’s sidebar.

    Is this still to expensive of a query?

    Here’s a workaround I have used for making a widget appear on every sidebar(for each blog using the same theme) using the widgets from blog_id 443. I use this in a functions.php of a child theme of twentyten:

    [Code moderated as per the Forum Rules. Please use the pastebin]

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Same widget on all blogs.’ is closed to new replies.