Widgetized Footer to WordPress Theme

The first step is to register the “sidebars.” To do this, simply replace the current contents of the functions.php file with the following:

<?php
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'Sidebar',
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'Footer',
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
?>

Now we’ll go into sidebar.php and replace the current dynamic sidebar conditional tag with this:

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

With this:

<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Sidebar") ) : ?>

Now we’ll go into our footer.php file and wrap the footer items in it’s own respective sidebar conditional tag. Right before the first “sidebar-item” div, add the following.

<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Footer") ) : ?>

Right after the final closing “footer-item” div (and above the “clear” div which we added earlier) we’ll add the following:

<?php endif; ?>

Okay, now our sidebar and footer should be widgetized. Let’s test it out by adding a few widgets in the footer. I’ll add a Blogroll widget, Recent Comments widget, and a text widget. Here’s what it should look like:

Green Rays Footer 3