Home | About Me | Contact Me | Archives | Advertise | Make Money Online

Enter Name:
Enter Email:
What is this all about? | COWpetition Home Page
SEOmoz.org - Learn From SEO Experts. Become an Expert.

How To Wigetize A WordPress Theme

Bookmark and Share
Written by Garry Conn on September 4th, 2007 | 14 Comments


With newer versions of WordPress being released with widgets, it is no longer necessary to download widgets from Automattic and install the plugin on your current Wordpress install. Modern versions of WordPress already come widgets ready. However, there are some situations where you find a WordPress theme that you really like, but soon discover that its not widgets ready. This article will teach you how to Wigetize a WordPress theme so that you can enjoy all the neat and robust features includes with Wordpress widgets.

You will know fairly quickly if your current theme isn’t widgets ready. You will see a screen like this:

no-sidebars-defined

Your screen will say, “No Sidebars Defined”. It will prompt you to visit a site called Automattic for instructions on how to widgetize your WordPress theme. Don’t worry, making a WordPress theme widgets ready isn’t difficult at all. I would recommend that you make a back up of your current theme before you do any modifications to the files within. Below are some easy and simple to follow instructions that will help you make your current WordPress theme widgets ready.

If you want detailed instructions on how to do this, I would visit the site titled Automattic. However, their page tend to make a mountain out of a mole hill. The hard part of widgets has already been done. With WordPress adopting the technology and including widgets into their program, widgeting themes couldn’t be any easier.

<?php
if ( function_exists(’register_sidebar’) )
register_sidebar();
?>

and…

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

is the magic code that transforms your boring and featureless theme into something fun, exciting and packed full of options. It really doesn’t get much easier. Here are the steps to wigetizing your current WordPress theme.

  • Step One: Make a backup copy of your current theme.
  • Step Two: Open your functions.php file and add the follow code to the top of the page and then save and upload the file.

    <?php
    if ( function_exists(’register_sidebar’) )
    register_sidebar();
    ?>

  • Step Three: Open your sidebar.php file and add this line of code directly below the <ul> tag. If your sidebar doesn’t use unordered lists, then you will need to read Automattic for further instructions. Keep in mind that using unordered lists have become the standardized way to code WordPress themes. You might want to consider using a different theme.

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

  • Step Four: Still working on the sidebar.php file. Scroll down to the bottom until you see the closing </ul> tag. Directly above it, add this line and then save and upload your file.

    <?php endif; ?>

That is it! Pretty simple? More to come. In a future article I will show you how to widgetize multiple areas of your current theme. Perhaps you have two sidebars, maybe you want to widgetize your footer or even your header. Any section of your blog can become widgetized. It’s just a matter of adding the right code in the right spot. Keep an eye out for some more posts about widgetizing other areas of your WordPress theme in the near future.

GarryConn

Share and Let Others Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • TwitThis
  • co.mments
  • del.icio.us
  • Google
  • StumbleUpon
  • Digg
  • Technorati
  • Reddit
  • Facebook
  • Mixx
  • Blogosphere News
  • Blogsvine
  • Bumpzee
  • e-mail
  • Sphinn
  • Fleck
  • Furl
  • Propeller
  • Spurl

    Footnote Ads:

  1. Joel Comm's Free Adsense DVD - Get your very own copy of Joel Comm's FREE DVD. It is packed full of Ready-to-Copy profit secrets of the World's Most Recognized Adsense Experts! (Hurry supplies are limited!)
  2. Search Engine Optimisation - Leading Australian search engine marketing company offering search engine optimisation and paid search management services
  3. Shopping Cart Software - World class shopping cart softwarewhich makes it easy to sell anything online.

RSS feed | Trackback URI

14 Comments »

Comment by IngaOz Subscribed to comments via email
2007-09-05 04:37:15

Great article! Thank you! Time to time I really was in this situation - found nice theme but didn’t used it because it was not widgetized…

 
Comment by Garry Conn
2007-09-05 15:16:05

I am glad it helped. The process overall is really pretty simple. And with WordPress already having widgets migrated in, more than half the battle is over.

 
Comment by Brian Subscribed to comments via email
2007-09-06 09:00:17

Hi Gary,

I was happy to find your site. You made widgitizing the ocean mist theme so easy. Unfortunately, I have no functions.php file.

Here are the files I have:

Stylesheet
Main Index Template
Header
Search Results
Sidebar
Archives
searchform.php
Single Post
Comments
Page Template
404 Template
Footer

and index.php

Is there any way to follow your directions without a functions.php file?

Thanks,
Brian

 
Comment by Jeremy Steele Subscribed to comments via email
2007-09-06 21:50:15
 
Comment by Boo
2007-09-18 17:52:09

I’m with Brian, same files no function.php

 
Comment by Nin
2007-09-19 05:11:53

Brian…you need to create your own in the same directory as where your sidebar.php file is located. Just create the file and post in the necessary details.

 
Comment by Brennan Kingsland
2007-09-22 06:11:21

Thank you so much. After hours of diligent surfing, I found the perfect theme.
After it was installed I realized it was not widget ready. Now it will be.

THANK YOU! THANK YOU! THANK YOU!

 
Comment by Hopeful Spirit
2007-09-28 09:24:41

Doesn’t work. I followed your instructions step by step but still get the same message as your top screenshot.

 
Comment by Carol Jones
2007-10-02 12:00:30

You are the best. I can’t tell you how many confusing articles I tried before I found this one. I’m in the same boat as Brennan -finally i found MY theme and not widgitized. Bummer. I am new to all this but you have given the courage to keep trying. Thanks again, and have a wonderful day.

 
Comment by Gene Steinberg Subscribed to comments via email
2007-10-20 15:57:22

All right, I ran into troubles too.

I adjusted the sidebar.php file per instructions.

Having no functions.php file, I created one and pasted in your code.

After doing this, my blog simply came up with an empty page. No content.

Clearly we’re missing something here.

Does anyone want to assist me?

Peace,
Gene

 
Comment by Nouk
2008-01-03 06:43:25

I get this error:

Parse error: syntax error, unexpected $end in /home/nouk/public_html/wp/wp-content/themes/PFM/sidebar.php on line 82

What shall I do?

Thanks,
Nouk

 
Comment by tacitus
2008-01-16 14:56:06

Nouk - just had the same problem. You probably left out the at the end of the sidebar file. At least, that’s what I did!

 
Comment by upstylo
2008-02-27 03:11:22

Thanks Gary for this useful tutorial :). Really helpful to me, since I’ve a project that need to be widgetized. Thanks …

 
Name (required)
E-mail (required - never shown publicly)
URI
Subscribe to comments via email
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> in your comment.

Trackback responses to this post