Lalaith
Member
Posted 3 years ago #
I created a theme for a blog that has two sidebars. I want to have widgets in both sidebars, but right now the sidebars are exactly the same. I did a search on the forums here and I found out that I can fix this problem by naming each of my sidebars, but I'm not exactly sure how to do that. Here's my functions.php:
<?php
if ( function_exists('register_sidebar') )
register_sidebar(sidebar-left);
register_sidebar(sidebar-right);
?>
Do I need to define names for my sidebars in sidebar-right.php and sidebar-left.php?
You'll have to do two things: first, register the sidebars with different names like so:
register_sidebar( array('name'=>'sidebar-left') );
register_sidebar( array('name'=>'sidebar-right') );
Second, when calling dynamic_sidebar pass the appropriate name of the sidebar to the function:
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar-left') ) : ?>
<?php endif; ?>
or
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar-right') ) : ?>
<?php endif; ?>
You can read more about that in the docs.
Lalaith
Member
Posted 3 years ago #
It's working perfectly. Thank you very much! I really appreciate it. =D
mikoleg
Member
Posted 3 years ago #
it does not work in wp 2.8.x stable, its loosing widgets.. what the hell is going on with wordpress