• Resolved lalaith

    (@lalaith)


    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?

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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.

    Thread Starter lalaith

    (@lalaith)

    It’s working perfectly. Thank you very much! I really appreciate it. =D

    it does not work in wp 2.8.x stable, its loosing widgets.. what the hell is going on with wordpress

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Two widgetized sidebars’ is closed to new replies.