Support » Themes and Templates » Sidebar2 doesn’t show in Widget Dashboard

  • Resolved dstall

    (@dstall)


    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’); ?>

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

Viewing 1 replies (of 1 total)
  • The topic ‘Sidebar2 doesn’t show in Widget Dashboard’ is closed to new replies.