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:
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.