The MU forums have moved to WordPress.org

General Widget Questions (22 posts)

  1. slipxaway
    Member
    Posted 17 years ago #

    Is there a way to globally activate certain widgets so that they will already be activated on all blogs?

    Also, I'm planning to use my own Adsense on each blog and I was planning to incorporate this into the sidebar. But with widgets installed, users can pick and choose what they want displayed in the sidebar, so is there anyway to enforce an ad placement while using widgets?

    Thanks for the help!

  2. andrea_r
    Moderator
    Posted 17 years ago #

    Put the adsense code in the sidebar outside the widget loop. :)

    I've got my widgets in the mu-plugins, so they are all one for everyone. unless the user rearranges things, they see the original theme's sidebar.

  3. nexia
    Member
    Posted 17 years ago #

    if you want to "force" or "hardcode" things so all your users have the same setting, you have to add the code yourself inside the theme, where you want to show it. usually, you have to edit the sidebar.php template, outside the loop, so they are not disabled when your users move things around.

  4. slipxaway
    Member
    Posted 17 years ago #

    Ok, I appreciate the help. I've already done some extensive editing in the sidebar.php for all the themes, before finding out that Widgets could be used to do all that :) I did install the widgets in the plugins directory, but then deleted them until I could find out how to do it globably. I just wasn't sure if it was something I could edit or if I had to make a special widget and figure out how to make it stationary. But now I know where to look so it shouldn't be a problem.

    Thanks again for the help.

  5. slipxaway
    Member
    Posted 17 years ago #

    Alright, I got the widgets working in the mu-plugins directory. I had to change the file path in the widgets.php, (Sidebar Widget), but it seems to be working great! Thanks :)

  6. slipxaway
    Member
    Posted 17 years ago #

    Ok, have another question pertaining to the original. Does anyone know how to put something outside of the widget loop at the end and get it to work properly? The problem I am having is that if the user has arranged their widgets, it displays fine, but if they are using the default sidebars.php, with the ad code outside of the widget loop, it's causing everything to lose its formatting and display on the left side of the theme, instead of the right.

  7. andrea_r
    Moderator
    Posted 17 years ago #

    Make sure you still have in the sidebar divs. :)

  8. slipxaway
    Member
    Posted 17 years ago #

    Believe me, I did :) I've spent many hours trying to figure out what was wrong, trying every possible thing I could think of. It would either display properly in the default mode or if they were using widgets, but not both.

    Turns out the problem was that the < /ul> and </div> for the last default section (not the entire sidebar </div>) was after the <?php endif; ?>, which threw the whole thing off. I never thought this could be the problem, because it's how the original sidebar.php came and I figured the coder of the theme knew more than me, so it was there for a reason :)

    It seems to be working now though, so I can stop pulling my hair out.

    Thanks:)

  9. andrea_r
    Moderator
    Posted 17 years ago #

    Cool. :) And yeah, I've seen some pretty awful coding in themes... so not surprised there.

  10. slipxaway
    Member
    Posted 17 years ago #

    Ok, one more question about widgets and I'm done, I promise :)

    Is there anyway to set it up so that specific widgets are already placed into the Sidebar under the Sidebar Widgets section when a new user is created?

    For example, a new user signs up... Instead of seeing the default sidebar.php, there would already be set widgets in place that would be viewable from the start. Then the user could choose to rearrange or remove certain ones at a later time.

    I'm just trying to make it so each blog is as uniform as possible to start and showcases the "features" of the site, rather then a generic default sidebar.php

  11. DoggyBloggy
    Member
    Posted 17 years ago #

    Sorry to dredge up an old post, but I see that the original question wasn't really addressed. I'm also interested in setting up default widget activation on all new blogs created. Is this possible? Has anyone done this?

    I assumed that the admin could go into each blog and activate widgets manually, but this doesn't seem to be the case. When I log into the admin for a given blog, I do not see the widgets tab. I only see the widgets tab on the admin's main blog and ones I set up myself. I would think that admins would have total control over user blogs.

  12. Ovidiu
    Member
    Posted 17 years ago #

    one more related question:

    is it wise to put all wodgets into mu-plugins? I mean they are all active now, doesn't that slow down the whole system or only when these widgets are used?
    Concerning plugins I usually try to activate as few as possible - same thing for widgets?

  13. badlagar
    Member
    Posted 17 years ago #

    Im also interested in put widgets active by defect and put a default widgets. any idea for do this?

  14. lunabyte
    Member
    Posted 17 years ago #

    The main widgets plugin file, and any additional widgets should all be in the mu-plugins directory so that they are available to everyone.

    As for a "default" layout of widgets on each sidebar, for each new user, it would require tweaking the queries that run when a new blog is created.

    Unless you do that, then widgets themselves won't be used until someone drags one to their sidebar, and they will just get the default sidebar(s) specified with each theme.

  15. badlagar
    Member
    Posted 17 years ago #

    Any know how to make this? (tweaking the queries that run when a new blog is created)

    Sorry but my english is veeery bad and i must copy your text ;)

  16. Ovidiu
    Member
    Posted 17 years ago #

    ok, I jsut transfered all my widgets into mu-plugins folder, but what about the other content of my plugisn/widgets folder:

    classic/
    default/
    scriptaculous/

    do I move these folders too?

  17. andrea_r
    Moderator
    Posted 17 years ago #

    Well, that's what the instructions said to do....

  18. Ovidiu
    Member
    Posted 17 years ago #

    didn't read any, just moved all widgets,... where can I read the proper instructions?

  19. andrea_r
    Moderator
    Posted 17 years ago #

    In the readme with the widget plugin.
    or
    The page where you downlaoded widget (ie - the widget site listed at the top of the page in widgets'php.)

  20. fralenuvol
    Member
    Posted 17 years ago #

    Personally I used the following approach to have an "persistent sidebar" globally activated for all blogs:

    I tweaked only a bit the function dynamic_sidebar() in widgets.php (inside mu-plugins directory), without touching the queries:

    AFTER:
    function dynamic_sidebar($name = 1) {
    global $registered_sidebars, $registered_widgets;

    ADD:
    wp_sidebarstart();

    AFTER:
    if ( empty($sidebar) || !is_array($sidebars_widgets[$index]) || empty($sidebars_widgets[$index]) )
    {

    ADD:
    wp_sidebarcustom($name);
    wp_sidebarend();
    return true;

    BEFORE:
    return $did_one;

    ADD:
    wp_sidebarend();

    What happens is the following:
    - Whatever you put in your function "wp_sidebarstart()" will ALWAYS be shown at the beginning of the sidebar (after starting <ul>)

    - Whatever you put in your function "wp_sidebarend()" will ALWAYS be shown at the end of the sidebar (before ending </ul>)

    - Whatever you put in your function "wp_sidebarcustom()" will be shown INSTEAD OF default sidebar content, only if user does not customize widgets, and NOT shown, if user customize widgets.

    Therefore we will have the following schema:
    <ul>
    CustomSideBarStart (Always)
    ....
    CustomSideBarContent /or/ CustomWidgets
    ....
    CustomSideBarEnd (Always)
    </ul>

  21. CoreyCampbell
    Member
    Posted 16 years ago #

    I don't quite understand. Can you give an actual example? It would be nice to have a plugin that would default to the admin sidebar blog.

  22. CoreyCampbell
    Member
    Posted 16 years ago #

    How would I setup the sidebar after editing the widget file?

About this Topic

  • Started 17 years ago by slipxaway
  • Latest reply from CoreyCampbell