HowTo: Convert Non-Widget to Widget Ready WordPress Theme

This is really awesome. Many a times I have loved a theme, but I shy away from using it. Why? I know nothing about coding and I would prefer to have have widget ready themes. Over last couple of weeks, I have surely learnt that all plugin and widget ‘functionality’ lies in the functions.php!

Infact, last week I borrowed some cool functionality from one theme and massaged that into my other theme. Wow, it worked! So, here is a how-to for converting non-widget ready theme to a widget ready theme!

Functions.php is the file you should be looking for. Insert this code in the file

if ( function_exists(’register_sidebar’) )

Now you need to modify your theme’s sidebar.php


<div id=”sidebar”>
<h2>Search this site</h2>
<div id=”searchdiv”>
<form id=”searchform” method=”get” action=”<?php echo $_SERVER[’PHP_SELF’]; ?>”>
<input type=”text” name=”s” id=”s” size=”20″/>
<input name=”sbutt” type=”submit” value=”Go” alt=”Submit” />
<?php if ( !function_exists(’dynamic_sidebar’)
|| !dynamic_sidebar() ) : ?> // added

<h2><?php _e(’Archives’); ?></h2>
<ul><?php wp_get_archives(’type=monthly’); ?></ul>
<h2><?php _e(’Categories’); ?></h2>
<ul><?php list_cats() ?></ul>
<h2><?php _e(’Meta’); ?></h2>
<?php wp_register(); ?>
<li><a href=”<?php bloginfo(’rss2_url’); ?>”>RSS</a></li>
<li><?php wp_loginout(); ?></li>
<?php wp_meta(); ?>
<?php endif; ?> // added

That’s it! You are all sorted mate to have a widget ready theme! Give it a shot. Its straight forward!

21 Replies to “HowTo: Convert Non-Widget to Widget Ready WordPress Theme”

  1. Manu,
    I will try to have a look. But this theme comes with sidebar widgets, sidebar modules (you need a plugin for that though). How can you widegetize an already widgetized theme 🙂


  2. I was hoping to upgrade this theme my client wanted to use “falling-leaves-09” to use widget and was excited to find your post. However, there is no funtions.php in the theme’s files. :-/

  3. Hi Ben,
    Create a functions.php file – copy from here

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

    Let me know how you go with this.


  4. I know convert one sidebar to widget ready…
    but I need 3 collum themes,
    one sidebar left (main content) right sidebar

    I tryed everything but every time goes wrong…
    can you help me ?

    since now thanks…

  5. To make two sidebar widget, first do:

    File = functions.php

    File sidebar.php

    In the sidebar you should put two parts of code, in the begin you should copy and paste the follow code:

    At the end of the sidebar.php you should copy and paste this code:

    What does it mean ? These lines tell wordpress to show dinamic sidebar if exist, if don’t, than wordpress show the default sidebar…

    Here it is. To create the second widget sidebar, you have to create other “sidebar” file, you can copy your sidebar.php and rename as sidebar2.php or whatever you want, the name doesn’t matter. Just make a copy of your sidebar.php and rename.

    Now, open the sidebar2.php and do the same as before, put the follow code:

    At the end of the sidebar2.php you should copy and paste this code:

    Now, it’s almost done, but… you have to include the second sidebar ok ? To include sidebar2.php in your template you have to decide if you sidebar will appear only on “post pages” or only in “page templates” or “archives templates”.. I made my 2 sidebars appear in every page of my site.

    To include the “sidebar2.php” in any template you have copy and paste the follow code:

    It’s not a trick but I think this may help some of them:

    If you want to put “sidebar in left side, main content, sidebar in right do this:

    “first you call =
    “than you call = the content

    and finally you call =

  6. HI,
    Thanks for sharing the code. It got usurped since its a code. I would suggest you to email me the code and I will post it here or if you want to enclose the code in

    your code

    it might work.

    Look forward to your response.

  7. Hey, i did this however i get an error when ever i try to update a plugin or any updates.

    Warning: Cannot modify header information – headers already sent by (output started at /home/www/ in /home/www/ on line 689

    My theme didn’t have a functions.php file i had to create one.

    What should i do? If i remove my functions.php file and try to update things, etc… its all fine but when i upload my functions.php file and try to update things it goes crazy.

    Nice article, really helpful though.


Comments are closed.