How to add a widget to the sidebar

There are basically two ways to add widgets to the sidebar. The easy one for people who use a widget-ready theme, and then there’s the way for people who are either using a non-widget-ready theme or are weird German guys with too much time on their hands, who prefer to mess with the code. Uhm, yeah, that would be me.

The easy way

Go to your admin panel and click on presentation. Under “widgets” you see your sidebar(s). Don’t worry, that’s just the widgets. The non-witgetized parts of the sidebar are not shown. You didn’t lose them.

Widget - opens in new windowDrag a “Text 1″ widget into your sidebar.

Click the configure button on the right.

Paste the code you copied from the widget provider (i. e. BlogCatalog) into the big text field.

Close it, click “Save Changes” and you should be set.

The harder way

Open your sidebar.php in a text editor. I prefer to have the widget above the meta section of the sidebar, so I look for it in the code. Ah, there it is.

<li><h2>Recent Entries</h2>
<ul>
<?php query_posts(’showposts=10′); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<li><a href=”<?php the_permalink() ?>”><?php the_title() ?></a></li>
<?php endwhile; endif; ?>
</ul>
</li>

<li><h2>Meta</h2>
<ul>

It will look different in your theme. Just make sure you found the meta part. Before you edit anything, you should make sure that you have a backup copy of the file. Now I will paste the code from the widget provider into the theme, which results in this:

<li><h2>Recent Entries</h2>
<ul>
<?php query_posts(’showposts=10′); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<li><a href=”<?php the_permalink() ?>”><?php the_title() ?></a></li>
<?php endwhile; endif; ?>
</ul>
</li>

<ul>
<li><script type=”text/javascript” src=”http://www.blogcatalog.com/w/recent.php?id=XXXXXX”/script></li>
</ul>

<li><h2>Meta</h2>
<ul>

As you can see, I also gave it ul and li tags, to match the rest of the sidebar. Save the file, upload it to your ftp, thus replacing your old sidebar.php. You should be able to see your shiny new widget now.

I hope this was of help to you. If it was (even if not), drop me line. I’m always interested in feedback.


Share This

Popularity: 99% [?]

Tags: , , ,
Share Results

12 Responses to “How to add a widget to the sidebar”

  1. I tried the hard way once and broke my blog…thank god for drag and drop!

  2. Thanks, this was really helpful

  3. For those who break their blogs like Andy, try any changes you want to make on a test blog first. Keep your test blog as similar to your original one in production.

  4. sometimes, widgeting end up my blog into mess. So, i better don’t this to better control of my sidebars.

  5. For your keyword research try using KeywordSpy.com - a keyword research technology that will help you know what keywords your competitors are using and how it generates money for them, you can use those keywords to drive traffic to your site and give your business the exposure it needs. It offers Free trials.- http://www.keywordspy.com/

  6. Thanks for the info. Having some problems with my side bar.

  7. wow spoer

  8. Hi

    I want to ADD a widget (plug-in) “Event Calendar” to my friend’s blog at: http://www.womenonair.biz/blog to the right sidebar

    when I drag and drop the Event Calendar widget, it REPLACES the entire existing sidebar

    I just want to ADD the new widget; actually I want to replace an existing graphic on that right sidebar with the widget

    can you tell me how to do that without my entire sidebar disappearing??

    thanks for this very informative site!!

  9. Thanks, this was really helpful

  10. Thanks for the info. This might sort my problem. If not I will be back..

  11. sometimes, widgeting end up my blog into mess. So, i better don’t this to better control of my sidebars.

  12. It worked, at last. Thanks so much :-)

Leave a Reply

Readers who viewed this page, also viewed:


Close
E-mail It
Socialized through Gregarious 42