0

Add Multiple Extra Sidebar Widgets For WordPress Themes

There are actually very few WordPress themes which has multiple dynamic sidebars for WordPress widgets. As we know sometime we get to insert so many sponsors banners, affiliate banners etc that we find scarcity for sidebars. So here is a simple WordPress hack to insert multiple dynamic sidebars for WordPress widgets.

2 WAYS FOR ADDING MULTIPLE DYNAMIC SIDEBARS FOR WP WIDGETS:

1. Edit Functions.php file for Multiple Dynamic Sidebars.
2. Adding Sidebars to Sidebar.php WordPress Themes.

Lets see in details how it works actually.

STEP  1: Edit Functions.php file for Multiple Dynamic Sidebars.

1. First step is to register your sidebars at function.php file so open it on notepad or Dreamweaver or any other text editor.
2. Replace

php
if ( function_exists('register_sidebar') )
register_sidebar();
?>

with the below code

php
if ( function_exists('register_sidebar') )
register_sidebar(array(
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h4>',
'after_title' => '</h4>',
));
?>

To add multiple sidebars, simply add the below code in place of previous code

php
if ( function_exists('register_sidebar') )
register_sidebar(array('name'=>'sidebar1',
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h4>',
'after_title' => '</h4>',
));
register_sidebar(array('name'=>'sidebar2',
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h4>',
'after_title' => '</h4>',
));
?>

On one of my customized WordPress theme I have added 4 such multiple sidebars.

Add Multiple=

STEP 2: ADDING SIDEBARS TO Sidebar.php WORDPRESS THEMES:

1. Open sidebar.php and look for the exact place where you would like to add new multiple sidebars.
2. To add sidebar1, add below code at sidebar.php

<?php if ( !function_exists('dynamic_sidebar')
|| !dynamic_sidebar('sidebar1') ) : ?>
endif; ?>

3. Similarly to display another sidebar2, add the below code

<?php if ( !function_exists('dynamic_sidebar')
 || !dynamic_sidebar('sidebar2') ) : ?>
 endif; ?>

4. SAVE the WordPress theme and upload to server using Filezilla or what ever you use.

I hope this was an understandable article for you and many of you successfully added extra multiple sidebars.

Read and Subscribe to Feeds because you are going to get lots of valuable tips here.

To Get Instant Updates From SagarDezign dot Com, Enter your email address :



Filed in: Wordpress, WP Tips & Tricks Tags: , , , , ,

Related Posts

Bookmark and Promote!

Leave a Reply

Submit Comment

© 2012 SagarDezign dot Com. All rights reserved. XHTML / CSS Valid.
Proudly powered by www.sagardezign.com.