WordPress.org

Ready to get started?Download WordPress

Forums

Use sidebar vs. add widget (8 posts)

  1. megmorris
    Member
    Posted 5 years ago #

    I just downloaded wordpress.org the other day after using wordpress.com for a couple years, so thanks for bearing with me.

    I have uploaded my template and am trying to add widgets to my sidebar, but I don't really understand exactly how it works. When I go under Widgets, I see a left hand column full of available ones, but on the right I see something that says "Current Widgets" with a drop-down menu that only has one selection: Sidebar 1. I like everything in sidebar one, though I'd like to remove some things and add others. I realize that I can go into the sidebar editor and delete the code for some things.

    But my problem is this: I downloaded a plugin I would like to use in my sidebar (delicious links), but when I select it from the widget list and edit it, when I look at my blog, all of the things that were there before as part of Sidebar 1 are now gone.

    Is there not anyway to use Sidebar 1 with other plug ins? If I want to use one plugin, do I have to also go out and find plugins separately to function as Sidebar 1 did before I added a new widget?

    Thanks so much, and sorry if this is not explained very well.

  2. Len
    Member
    Posted 5 years ago #

    You downloaded wordpress.org? Holy crap that must have taken awhile - the Codex alone is 1,000 pages. :)

    I'm not completely understanding. Are you trying to add widgets in conjunction with hard code? For instance, you have some items hard coded in your sidebar such as Recent Posts, Blogroll etc then add a widget? If so then the hard coded items will disappear as the widgets override them. You can't have both - only one or the either.

  3. MichaelH
    Member
    Posted 5 years ago #

    Many themes, including the WordPress Default theme are designed to either use Widgets or if no Widgets are configured, then use the code that is in the sidebar.php file.

    For example, in wp-content/themes/default/sidebar.php there is this code at the top of the file:

    <?php 	/* Widgetized sidebar, if you have the plugin installed. */
    if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>

    That essentially says, "if widgets are configured use those and ignore all the code upto the endif, but if not, use the rest of the code in sidebar.php". You could move the code around in sidebar.php to use widgets but also use MORE of code in the sidebar.php script.

    Some plugins don't offer widgets, so if you desire to use widgets from most things, and want to avoid editing the sidebar.php to add plugin code then consider downloading and installing Otto's PHP Code Widget.

    Then put code like this in one of those widgets:

    <?php wp_get_archives('type=daily&limit=15'); ?>

  4. megmorris
    Member
    Posted 5 years ago #

    @LenK Sorry, I said I downloaded wordpress.org because I use Bluehost and they list it in "my installs." I just meant that I am not using wordpress.com, but rather wordpress.org and hosting it myself.

    Basically I don't understand why I have widgets available to use on the lefthand side of my Widgets page, but when I select a widget to use, it makes all of the other sections (categories, blogroll, etc) that came pre-populated with the template go away.

    But I think what MichaelH is telling me is that I can either use the standard sidebar that comes with the theme, or I can choose widgets and plugins that I have to find myself.

    Right?

  5. dcole07
    Member
    Posted 5 years ago #

    when I select a widget to use, it makes all of the other sections (categories, blogroll, etc) that came pre-populated with the template go away.

    Yeah, your understanding MichealH right.

    Many things in life, including sidebars in WordPress Themes come with a backup plan if they can't find what their looking for. If you don't answer your phone at home, your friends are going to try your cell phone, or work phone. The same goes with sidebars, if WordPress can't find any Widgets, it displays some standard ones set by the theme.

    @LenK WordPress.org is short for the self hosted WordPress Software and is a common term in the WordPress community. ... so people who use this term are not referring to downloading the pages on http://wordpress.org, which would be closer to 15,000,000 rather than 1,000.

  6. Len
    Member
    Posted 5 years ago #

    @LenK WordPress.org is short for the self hosted WordPress Software and is a common term in the WordPress community. ... so people who use this term are not referring to downloading the pages on http://wordpress.org, which would be closer to 15,000,000 rather than 1,000.

    Uh, yeah I got that hence the :)

    My attempt at a little humour which sometimes helps when people are frustrated. But thanks anyway. :)

  7. MichaelH
    Member
    Posted 5 years ago #

    But I think what MichaelH is telling me is that I can either use the standard sidebar that comes with the theme, or I can choose widgets and plugins that I have to find myself.

    And ultimately, something like Otto's PHP Code Widget, RSS Widgets, and Text Widgets, can provide about anything that is typically provided by the 'hard-coded' features of a theme's sidebar.

  8. fromtheranks
    Member
    Posted 5 years ago #

    MichaelH,

    For example, in wp-content/themes/default/sidebar.php there is this code at the top of the file:

    <?php /* Widgetized sidebar, if you have the plugin installed. */
    if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>

    That essentially says, "if widgets are configured use those and ignore all the code upto the endif, but if not, use the rest of the code in sidebar.php". You could move the code around in sidebar.php to use widgets but also use MORE of code in the sidebar.php script.

    Could you please make your answer extra "sticky" somewhere or include it in the Codex? I've been trying to figure out for (well, too long): (1) how did widgets get on my site by default when I can't find them listed in Appearance --> Widgets, and (2) what happens with those widgets if I change something.

    Your answer above nails this down perfectly, but I had a heck of a time finding it.

    Thanks in advance.

Topic Closed

This topic has been closed to new replies.

About this Topic