Forums

[resolved] Sidebar2 doesn't show in Widget Dashboard (2 posts)

  1. DStall
    Member
    Posted 2 years ago #

    How can I make Sidebar 2 option to show in Widget Dashboard for adding widgets? Currently only Sidebar 1 shows as option, even though I have both sidebar1.php and sidebar2.php files included in index.php file using the following code (preceded by <?php):

    include (TEMPLATEPATH . '/sidebar1.php'); ?>
    include (TEMPLATEPATH . '/sidebar2.php'); ?>

  2. Edward Caissie
    Member
    Posted 2 years ago #

    You will need code in your functions.php file that registers two (2) widget zones, with something such as this:

    if ( function_exists('register_sidebar') )
      register_sidebars(2,array(
          'before_widget' => '<div class="widget">',
          'after_widget' => '</div><!--/widget-->',
          'before_title' => '<h2>',
          'after_title' => '</h2>',
          ));

    Then you can set each widget zone separately, with code such as the following:
    - for widget zone 1:

    <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar(1) ) : else : ?>
    ...
    <?php endif; ?>

    ... and similar for widget zone 2:

    <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : else : ?>
    ...
    <?php endif; ?>

    Hope that gets you pointed in the right direction ...

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.