Adding Widgets To Your Sidebar

Posted under:
October 8th, 2008

If you are using a custom theme made by somebody other than yourself most likely you won’t have any idea on how to get widgets to work in your blog’s sidebar. So I decided to write up this post detailing how to do it and show you how extremely easy it is.

As a quick overview and for those of you unaware of what the hell I’m talking about let me explain really quick. A widget is a item that you can dynamically insert into your blog’s sidebar that adds extra functionality. Some of the default widgets provided by WordPress are recent posts, calendar, categories, tag cloud and so forth. So enough of my yapping, lets get to coding.

Most WordPress Theme developers will usually use a sidebar.php file in their themes. So with that said I am going to assume that there is at least 1 sidebar.php file in your current theme’s folder. Navigate to your theme’s folder and look for the sidebar.php file. If you have 2 sidebars it may have a number next to it. Open it up and you should see some PHP coding. This is where it can get tricky for those of you with no coding experience, but I will try to make it as easy to understand as possible.

When you insert the code I am about to give you the widgets are going to be inserted wherever you insert the code. If you already have some things in your sidebar you need to decide where you would like the extra widgets to show up. If you decide to place the code between some things in your sidebar just remember that when you place a widget it will bump whatever is below the widget code down. So the more widgets you add the further down the rest of the items in your sidebar will drop.

Here is the code that we are going to be using….

<?php if ( !function_exists(’dynamic_sidebar’) || !dynamic_sidebar() ) ; ?>

Make sure to copy and paste this code exactly, things can really get screwed up if even one character is off. Once you have the code copied, find a place in your sidebar where you would like widgets to display and paste the code there. Save your file, upload it to your server and you are all set. Now all you have to do is go into your WordPress Administration panel, click on Design then on Widgets and select which widgets you would like to show up in your sidebar.

What did you think it was going to be more complicated than that? Sure it may take some practice to get the code in the right spot to get things to show up how you want them to. But don’t fret if you can’t figure it out, if you are stuck you can always get ahold of me and I’ll do what I can to get it working for you :)

Related Posts

10 Comments

  1. Comment by: SuiteJ

    Nice explanation Jarret. Your Wordpress tips/tutorials are great. It will help smack the fear out of the non-coders and help them get in there and get their hands dirty! ;)

    Cheers!
    Jay

    SuiteJs last blog post..What’s On Your Desk… And What Does That Say About You?

  2. Comment by: Jarret

    Thanks Jay :)

    Most of this stuff is actually pretty easy as you can see from my last few posts. It is just knowing the PHP which most don’t.

    I am hoping that these posts help a few people in the future.

  3. Comment by: Garry Conn

    Holy Crap Batman… I did a post about a year ago where I explained how to do this, but I made the mistake in offering to help people WIDGETIZE their themes for free… I think I’ll just 301 redirect to this page. ;)

    Garry Conns last blog post..Can These Domain Names Make Money Online?

  4. Comment by: WordVixen

    Wow. Do you realize how many pretty themes I could use with this code? You da man!

    So, um, when are you addressing how to change theme colors and header images? Not that I’m pushing…

    WordVixens last blog post..Choose The Ads You Want To See

  5. Comment by: Rich Hill

    Good post Jarrett,

    We need more of these easy to understand explanations. I’ve been blogging for over 10 years, 90% of it was in a different field and not monetized. A year ago I joined this wacky fray into the mmo - How to - Niche Marketing, etc world and am just now starting to “get it.”
    Thanks.
    Rich

    Rich Hills last blog post..New Social Site Echodemic is in Beta - Promote Your Blog

  6. Comment by: Jarret

    @Garry - Haha, I don’t mind helping people out every now and then. Redirect as you please ;)

    @WordVixen - Glad you enjoyed it :) I will be addressing theme colors and header images next week! In fact I am always looking for post ideas to come up with so if you have anymore either leave a comment here or send me an email

    @Rich - Hey man! Haven’t seen you for awhile now.

    Easy to understand? Gotcha! I try to make it easy as possible for anybody that reads, I know I could go all into PHP and technical jargon but these posts are meant to help :) Thanks for stopping by

  7. Comment by: zolar

    Good explanation for wordpress user…
    For me.. It is easy by upgrade wordpress to get the sidebar..
    Or choose template that using widget like my rear-wheel.com blog

    zolars last blog post..100 Million Dollar Challenge

  8. Comment by: Hunchy from web site traffic

    Hey Jarret, one leeeetle thing that could get your readers pear-shaped - don’t forget you actually have to make sidebar.php ‘writeable’ before this edit will stick.

    I know you know what I mean, so I’ll leave it to you to cover in another post!

    Hunchys last blog post..Tips for ‘Made For AdSense’ (MFA) Sites

  9. Comment by: Hunchy from web site traffic

    Ah, now I know… sorry Jarret for using your comment stream as a laboratory, no offense if you delete this & above comment :-)

    Hunchys last blog post..Tips for ‘Made For AdSense’ (MFA) Sites

  10. Comment by: Jarret

    Hey Hunchy, yes that could be an issue depending upon how your webhost is setup or the type of FTP software that you use.

    I use both HostGator and GoDaddy for my web hosting and use Notepad++ to edit files on my server through their FTP as well as FileZilla for uploading files. I have never had a problem with a file not being write able or it not updating, but you do make a good point :)

This site uses KeywordLuv. Enter YourName@YourKeywords in the Name field to take advantage.