• @help: I am using this following code on sidebar.php, But i am getting single sidebar on customizer widgets panel. Do anybody have idea , what’s wrong i am doing.

    <?php
    /**
    * The template for the sidebar containing the main widget area
    *
    * @package WordPress
    * @subpackage Twenty_Sixteen
    * @since Twenty Sixteen 1.0
    */
    ?>

    <?php if ( is_active_sidebar( ‘sidebar-blog’ ) ) : ?>
    <aside id=”secondary” class=”sidebar widget-area” role=”complementary”>
    <?php dynamic_sidebar( ‘sidebar-blog’ ); ?>
    </aside><!– .sidebar .widget-area –>
    <?php else: return;
    endif;

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • hopefully you are adding or editing the code on a child theme and not on the parent theme, otherwise whatever changes you make will get overwritten when the theme gets updated.

    <?php if ( is_active_sidebar( 'sidebar-blog' ) ) : ?>
    <aside id="secondary" class="sidebar widget-area" role="complementary">
    <?php dynamic_sidebar( 'sidebar-blog' ); ?>
    </aside><!-- .sidebar .widget-area -->
    <?php else: return;
    endif;

    there isn’t anything necessaraly wrong with your code as long as

    • you have registered a sidebar called sidebar-blog on functions.php
    • you don’t really need the else: with the return; in this case you can just close the endif; instead.
    • make sure you dont need a closing php tag after the endif;
    Thread Starter Sushil Adhikari

    (@sushil-adhikari)

    Hi Xaview Serrano,

    Thank you so much for your response, but i don’t know what actually happening to my customizer.Now i am unable to get single sidebar , but three are still missing I think customizer widgets is taking sidebar from sidebar.php template.
    let’s say if i add another sidebar called sidebar-page-right it will display both of them.Similar goes to other two sidebar.

    <?php if ( is_active_sidebar( 'sidebar-blog' ) ) : ?>
    <aside id="secondary" class="sidebar widget-area" role="complementary">
    <?php dynamic_sidebar( 'sidebar-blog' ); ?>
    <?php dynamic_sidebar( 'sidebar-page-right' ); ?>
    </aside><!-- .sidebar .widget-area -->
    <?php else: return;

    endif;

    But if i simply add dynamic_sidebar( ‘sidebar-blog’ ); ?> it will display single sidebar on customizer preview.

    I had also tried by enabling debug mode and also checked console but i couldn’t find any error .

    You help will be highely appreciated.

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘customizer setting showing single sidebar on widgets menu’ is closed to new replies.