This tutorial deals with the Thesis wordpress theme. It may not mean much if you haven't worked with Thesis before.

The wonderful Thesis wordpress theme comes with two sidebars which are very configurable. You can insert widgets into either sidebar, exactly as you wish.

But what if you want to put a widget somewhere else?  Let’s take a look at the Tailored Web Services website.  (That’s my employer).   Look at the footer of this site.  There are three columns down there, and each one contains a widget.

So how did that happen?

The key functions here are register_sidebar() and dynamic_sidebar().

Together, these functions allow us to set up an extra “sidebar”, which will be widget-enabled through the wp-admin area.

Let’s start with this:

<?php 
add_action('thesis_hook_footer', 'customFooter'); 
function customFooter() {
  ?> 
  <div class="footer1"> 
    <ul class="sidebar_list"> 
      <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer1') ){ ?> 
        <li class="widget">Dynamic Widgets are not enabled</li> 
      <?php } ?> 
    </ul><!-- sidebar_list --> 
  </div><!-- footer1 --> 
  <?php 
} // customFooter 
?>

The function customFooter() is designed to insert the right code for a new “sidebar”.  And yes, we’re still calling it a sidebar even though it goes in the footer.

The add_action() line defines where this new block of code should go.  The Thesis User’s Guide contains a reference list of all hooks provided by Thesis.  In this case, we want it in the footer.

The dynamic_sidebar('Footer1') call tells Wordpress to output “Footer1” there if present.

Next, we need to use that register_sidebar() function to let us put widgets in there.

<?php 
register_sidebar(array('name'=>'Footer1', 'before_title'=>'<h3>', 'after_title'=>'</h3>')); 
?>

By default, your widget titles will always be wrapped in <h3> tags.  You can change that if you want to.  The important argument to this function is the “name”.  The name should be the same as you used in the dynamic_sidebar() call.  Be descriptive:  We should call this “Footer Left”, or “Footer Right” to avoid any confusion later on.

Here’s one I prepared earlier

Paste the code from this page into your custom_functions.php file.  When you add some CSS to float the columns side-by-side, you’ll get the same three-column footer we have on Tailored.