http://codex.wordpress.org/Widgetizing_Themes
You can use this approach to widgetize any template.
The template I’m using has already done what this page says. The only useful thing for me is the last section:
I have a theme with more than one sidebar. How do I make them all dynamic?
Oh, that’s easy. Instead of register_sidebar() you should use register_sidebars(n) where n is the number of sidebars. Then place the appropriate number in the dynamic_sidebar() function, starting with 1. (There are several other ways to use these function. See the API).
You can even give your sidebars names rather than numbers, which lets you maintain a different set of saved sidebars for each theme. But if you need to know so much about the plugin, why aren’t you reading the API?
But this is too general and I don’t understand exactly what kind of code I should add in functions.php file. The register_sidebar function is like this one:
if ( function_exists('register_sidebar') )
register_sidebar(array(
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h5 class="widgettitle">',
'after_title' => '</h5>',
));
Examples of multiple widget-capable areas:
FUNCTIONS.PHP
if (function_exists('register_sidebar')) {
register_sidebar(array(
'name'=> 'Top Tabs',
'id' => 'top_tabs',
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h2 class="offscreen">',
'after_title' => '</h2>',
));
register_sidebar(array(
'name'=> 'Top Sidebar',
'id' => 'top_sidebar',
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
register_sidebar(array(
'name'=> 'Left Sidebar',
'id' => 'left_sidebar',
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
register_sidebar(array(
'name'=> 'Right Sidebar',
'id' => 'right_sidebar',
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
}
RIGHT SIDEBAR:
<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Right Sidebar')) : ?>
[ do default stuff if no widgets ]
<?php endif; ?>
LEFT SIDEBAR
<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Left Sidebar')) : ?>
[ do default stuff if no widgets ]
<?php endif; ?>
etc etc
This post sorted it out for me… Time to add status resolved?