WordPress.org

Ready to get started?Download WordPress

Forums

Same widget on all blogs. (5 posts)

  1. Vinicius Massuchetto
    Member
    Posted 3 years ago #

    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.

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

  3. Justin Sternberg
    Member
    Posted 3 years ago #

    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?

  4. David Sader
    Member
    Posted 3 years ago #

    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]

  5. David Sader
    Member
    Posted 3 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic