How to add Dynamic Widget Ready Sidebars in WordPress
There are times when you want to display widgets on other locations than your default sidebar. With such high demand for this hack, we will be sharing how you can create multiple dynamic sidebars that are widget ready for your WordPress blog. There are some plugins that will require you to use the widget only, or in some cases widget is what you feel comfortable with then this is the hack for you.
First you will need to visit your functions.php located within your theme folder.
For users using WordPress 2.8.1 and above, add the following code in:
register_sidebars(3);
For users using below WordPress 2.8.1, we suggest that you upgrade. We will not be sharing a way to do this below that version.
By adding the code above, you told WordPress to add 3 additional sidebar for your widget section, so now in total you will have 4 sidebars.
In your WP-Admin area go to Appearance » Widgets and you should see something like this:

Choose the widgets of your choice and place them in the sidebars that you like to display these in. Now some of these sidebars can be displayed in the footer or anywhere else you like.
Once you have done adding the widgets to each sidebar, simply open up a theme file of your choice and paste the following code to display each sidebar.
<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : else : ?>
Insert text that will display only if you are not using any WordPress widgets in this sidebar.
<?php endif; ?>
Simply change the number 2 to the appropriate number. If you leave it blank, it will assume that the number is 1 and therefore display Sidebar 1.
By using this hack, you can accomplish results like we have in our footer:

This hack is very versatile and can come in handy in many cases, so save it, bookmark it, and share it with those who need it.
Comments
4 Responses to “How to add Dynamic Widget Ready Sidebars in WordPress”Share Your Opinions
Tell us what you're thinking...
and if you want a pic to show with your comment, then get gravatar!
Please make sure that you have read our Comment Policy.










Nice but would make more sense to give any sidebar (or better: widgetarea) a unique name although that requires a little mor code in the functions file. But it also adds more flexibility in terms of formating.
//Widgetized sidebar with unique name
if ( function_exists(‘register_sidebar’) )
register_sidebar(array(‘name’=>’Sidebar Name’,
‘before_widget’ => ”,
‘after_widget’ => ”,
‘before_title’ => ”,
‘after_title’ => ”,
));
Cheers
Michael
Yeah that code might complicate some users, that is why we didn’t provide it. It comes built-in with the default WordPress theme, and it is certainly a better code, but to keep it very simple, we used the other one.
Very usefull.
10x
very very good
Thank so much, it give me some ideas for new theme