Bootstrap Templates Bundle

Sunday, January 6, 2013

how-to-create-multiple-dynamic-sidebars-for-wordpress-widgets

Add this below code into your functions.php file


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>',
));


Add this below code where you want to show your  sidebar
Sidebar1 code goes like this

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


Sidebar2 code goes like this

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

If you want to add style then   

 <div id="postpagesidebar">
 <?php if ( !function_exists('dynamic_sidebar')
|| !dynamic_sidebar('sidebar2') ) : ?>
<?php endif; ?></div>

Source:
http://www.quickonlinetips.com/archives/2007/11/how-to-create-multiple-dynamic-sidebars-for-wordpress-widgets/
http://www.tastyplacement.com/add-sidebar-wordpress
http://howtomatter.com/how-to-create-a-new-widget-area/

No comments:

Post a Comment

Wokiee React eCommerce Template