• Home
  • New Entries
  • Popular Entries
  • Submit a Story
  • About

How to Create Multiple Dynamic Sidebars for Wordpress Widgets ...

In the last tutorial, you learnt how to widgetize your wordpress theme to support wordpress widgets. Now this tutorial explains how to create multiple dynamic sidebars to add various combinations of widgets to customize your wordpress theme even more.

In the last tutorial, you learnt how to widgetize your wordpress theme to support wordpress widgets. Now this tutorial explains how to create multiple dynamic sidebars to add various combinations of widgets to customize your wordpress theme even more. I suggest you read how to Widget-Enable Wordpress Themes in 3 Easy Steps before reading further as examples will be quoted in the same context.
Edit Functions.php for Multiple Dynamic Sidebars

The functions.php code which helped to widgetize your wordpress theme and support a single dynamic sidebar, now needs to be edited (using any text editor like Notepad) to support multiple sidebars. You remember we had modified the default function.php from

<?php
if ( function_exists( aregister_sidebar) )
register_sidebar();
?>

to the new code below to support our customized template with h4 subtitles and non-default unordered lists in the sidebar. REMEMBER you need to edit functions.php to match your wordpress theme or it will not work.

<?php
if ( function_exists( aregister_sidebar) )
register_sidebar(array(
efore_widget => ,
after_widget => ,
efore_title => <h4>,
after_title => </h4>,
));
?>

To support multiple sidebars, I simply need to specify that multiple sidebars be used and name them as I like. In our case I use Sidebar1, Sidebar2 etc and as many as you like. The code now looks like this -

<?php
if ( function_exists( aregister_sidebar) )
register_sidebar(array( ame=> isidebar1,
efore_widget => ,
after_widget => ,
efore_title => <h4>,
after_title => </h4>,
));
register_sidebar(array( ame=> isidebar2,
efore_widget => ,
after_widget => ,
efore_title => <h4>,
after_title => </h4>,
));
?>

I personally have extended this capacity to 6 dynamic sidebars on this blog. Here is how it looks like on top of admin panel.



 Now you can drag and drop widgets of your choice to different sidebars and customize the options. Remember to Save Changes or else all customization is lost.
Add Dynamic Sidebars to Wordpress Template

Now you need to place the code in the wordpress theme template where you want the relevant wordpress widgets to work. Instead of the previous code, you can place the different dynamic sidebars in different areas of the template.

Sidebar1 code goes like this
<?php if ( !function_exists( wouldynamic_sidebar)
|| !dynamic_sidebar( isidebar1) ) : ?>
<?php endif; ?>

Sidebar2 code goes like this
<?php if ( !function_exists( wouldynamic_sidebar)
|| !dynamic_sidebar( isidebar2) ) : ?>
<?php endif; ?>

Save the template and watch your widgets go live. You can add lots of dynamic sidebars with various widget combinations and have truly unique web design concept.

source; earlyspinblog

 View Full Story.
Posted at 01:42:28 pm | Permalink | Posted in How to Blog  WordPress Plugins  

Related Stuff

8 Fail Safe Tips On Creating An Awesome 404 Page

Oh the 404! Such a wonderful error to come across while browsing the web. Some are funny while others are ...

12 Essential Tips to Build Your First Wordpress Theme

I always wanted to contribute to the wordpress community by building a Wordpress theme and releasing it to public. After efforts of 20 days ...

SEO Your Wordpress Templates

Like many people, when I first started blogging, I discovered Wordpress and it’s many features that made it easy to set up and get ...

Facebook Connect Wordpress Plugin Leaked

A few sources have alerted me to a project that Facebook has been working on: integrating Facebook Connect directly with ...

Why is SEO so important to your site

You have heard the phrase LOCATION LOCATION LOCATION. But wait, this is online! You don’t have to worry about location… or do ...

Be the first ... |Add your comment.

Your Comment ...

  Name (required)

  Email (required, hidden)

  Website


Top Stuff

Free Blogger templates Anime Themes

GeekLog

Wordpress Guestbook Generator Plugin

Zookoda

Introduction to blogs and blogging

jumpcut


Our Partners

Facebook Applications

Ajax Projects

Web 2.0 Sites

Webloglines

Human Development Handbook

Software Development Company

Ajaxlines

Stock Exchange Chat


About Webloglines

Webloglines is a project offers a comprehensive collection of blogging services, articles, themes and plugins from around the world. Whether you're looking to promote your own blog or find blogs on various topics, this site is for you.


Search


Topics

  • Blogging Tips (50)
  • Blogs Slides (25)
  • Blogs Websites (22)
  • Digg (6)
  • How to Blog (41)
  • Search Engines (2)
  • SEO (27)
  • WordPress Plugins (61)
  • WordPress Security (18)
  • Wordpress Themes (22)
  • Wordpress Tips (26)

© 2006 www.webloglines.com. All Rights Reserved. Powered by IRange