First thing, open your theme’s functions.php (or create the file if it is not already there), then insert the following code:
<?php
if ( function_exists('register_sidebar') ) /* for compatibility with old WordPress versions */
register_sidebar('name=Left Side Bar');
register_sidebar('name=Right Side Bar');
?>
That creates two sidebars for us, one named ‘Left Side Bar’and the other named ‘Right Side Bar’.
Then create two other files:
- sidebar-left.php
- sidebar-right.php
In sidebar-left.php insert the following code:
<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(1) ) : ?>
<!-- Your sidebar contents here -->
<?php endif; ?>
In sidebar-right.php insert the following code:
<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : ?>
<!-- Your sidebar contents here -->
<?php endif; ?>
Final step is to include the sidebars in your template, so locate your main template file and insert the following lines where you want the sidebars to appear
<?php include (TEMPLATEPATH . '/sidebar-left.php'); ?> <?php include (TEMPLATEPATH . '/sidebar-right.php'); ?>
NOTES
Instead of using ids you could also use text strings when calling the dynamic sidebars. So for example in sidebar-left.php we could have used the code:
<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar('Left Side Bar') ) : ?>
<?php endif; ?>
This is mostly convenient when you have many sidebars and thus it would not be very intuitive to use their ids.
Also if you just wanted to have static sidebars with predefined content which cannot be changed, all you need to do is create the two sidebar files, then include them in the template as shown above. In this case there is no need to edit the functions.php file and to include the dynamic_sidebar code in the sidebar files.
For further reading about this topic check out the following links:
http://www.blogohblog.com/adding-extra-sidebar-to-your-wordpress-theme/
http://bloggingexperiment.com/archives/adding-sidebars-to-wordpress-themes.php
http://bloggingexperiment.com/archives/add-widgets-wordpress-themes.php
Related posts:

Web professional in Malta, Europe. Focusing on building visually stunning websites that are easy to maintain, usually using WordPress as the CMS. Web developing since 1995, loving WordPress for more than 5 years.
Hi,in my first visit here i got this worthy tutorial. I will use it for my wordpress blog. Thanks buddy.
Glad you found it useful