Widgets panel not displaying in the Theme Customizer

I see you’re talking about the dynamic_sidebar function but I don’t see you mention the sidebar file (eg. sidebar.php or sidebar-single.php).

There are basically 3 steps I follow to display sidebar widgets and they’re always visible in customizer. If yours is not showing up, you probably may have missed something.

1. The register part in functions.php


$args = array(
    'name'          => __( 'Main Sidebar', 'mytheme' ),
    'id'            => 'sidebar-1',
    'before_widget' => '<div id="%1$s" class="widget %2$s">',
    'after_widget'  => '</div>',
    'before_title'  => '<h3 class="widget-title">',
    'after_title'   => '</h3>'
);
register_sidebar( $args );

2. The function call in a sidebar file (eg. sidebar.php or sidebar-single.php)


<?php
// Dynamic Sidebar
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar-1') ) :
    // Sidebar fallback content
    get_sidebar();
endif;
// End Dynamic Sidebar Single posts
?>

3. Call the sidebar in the post/page template


<?php get_sidebar(); ?> or <?php get_sidebar('single'); ?> for sidebar-single.php

I would advise you to re-check your code to make sure you haven’t left anything out. All the best!

Leave a Comment