Creating Multiple Widget Sidebars
If you have multiple sidebars, or multiple themes with multiple sidebars, it’s a good idea to use dynamic sidebars. WordPress Widgets (WPW) is like a plugin, but designed to provide a simple way to arrange the various elements of your sidebar content (known as “widgets”) without having to change any code. What’s nice about using widgets is they’re easy to use and you have the contents of all your sidebars on one page so they’re easier to edit. When using different layouts with the same sidebar contents, all you need to do is call the sidebar functions to get the contents. If you want to insert php in your sidebar, there’s a plugin called PHP Exec. Click on that link and scroll down to where it says execphp.zip, and download it.
In order to use widgets, you need to place this bit of code in your sidebar.php or whatever your sidebar page is:
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('graphics') ) : ?>
<?php endif; ?>
Where it says “graphics”, replace it with whatever your sidebar name is mentioned in functions.php below.
You’ll need to make sure you have a functions.php in your theme folder. Inside functions.php, put this:
<?php
if ( function_exists('register_sidebar') )
register_sidebar(array('name'=>'journal',
'before_widget' => '<div id="sidebar">', // Removes <li>
'after_widget' => '</div>', // Removes </li>
'before_title' => '<p class="navi>', // Replaces <h2>
'after_title' => '</p>', // Replaces </h2>
));
register_sidebar(array('name'=>'about',
'before_widget' => '<div id="sidebar">', // Removes <li>
'after_widget' => '</div>', // Removes </li>
'before_title' => '<p class="navi>', // Replaces <h2>
'after_title' => '</p>', // Replaces </h2>
));
register_sidebar(array('name'=>'archive',
'before_widget' => '<div id="sidebar">', // Removes <li>
'after_widget' => '</div>', // Removes </li>
'before_title' => '<p class="navi>', // Replaces <h2>
'after_title' => '</p>', // Replaces </h2>
));
register_sidebar(array('name'=>'gallery',
'before_widget' => '<div id="sidebar">', // Removes <li>
'after_widget' => '</div>', // Removes </li>
'before_title' => '<p class="navi>', // Replaces <h2>
'after_title' => '</p>', // Replaces </h2>
));
register_sidebar(array('name'=>'graphics',
'before_widget' => '<div id="sidebar">', // Removes <li>
'after_widget' => '</div>', // Removes </li>
'before_title' => '<p class="navi>', // Replaces <h2>
'after_title' => '</p>', // Replaces </h2>
));
?>
Make modifications where it says “journal”, “about”, etc. Also you can chose different tags before where it shows comments such as //Replaces…The number of calls to register_sidebar depends on the number of sidebars you have.
Now when you go to wp-admin, under “Presentation”, there should be a link to “Widgets”. From there you can drag boxes under “Available Widgets” onto a sidebar box. Some widgets allow you to edit the contents or settings. Click on the icon on the right of the widget box in a sidebar to see what you can edit. Click on the “X” when you’re done editing. Don’t forget to “Save Changes”. To view changes, refresh your browser, or delete your cache and refresh again if you don’t see the changes.
Similar Posts
None Found
6 Comments
Thank you for taking the time to leave a message. Your comment is much appreciated. Also, please leave a comment relevant to the posted topic. If this is your first time commenting, your comment will be held for moderation before being displayed. If you would like a custom avatar to appear beside your message, please sign up for an account on Gravatar

Thank you so much for the lovely comment!
I LOVE the new theme by the way. Especially the personal and creative feel it has (the drawing at the bottom is cute and great!).
Yeah I know it’s completely different from the screenshots I showed at Tapestry, I had a sudden urge to make the layout a few nights ago and did. I still plan on making the last theme (the edible looking one lol).
And I’m happy you’ve found a new home and space. I really liked hosting you. You shall be missed! Hee, enjoy the new home.
I have finally found you again! I’ve updated your links and everything. I love the new layout, especially the color theme!
Thanks for also providing this little tutorial, it’s very thoughtful and nice! One day, I’ll be able to make multi-widget sidebars for a theme!
Oh my god, I’ve been looking for a tut on this forever. The other sites out there go through such long winded steps to create dynamic sidebars. THANK YOU.
Oooh, a change in links? *updates link*
Your new design is fab
Wow, this is really helpful, thanks! I’ve been a bit of a chicken over using widgets, but it actually looks really good! Thanks!
Oh, wow! This is quite handy.
I would have never attempted something like this on my own. Thanks for posting it.
Your blog is quite an interesting read as well. Keep it up!