• Resolved Oscar Contreras

    (@oscarcontreasnavas)


    I am building a new theme from scratch as part of my auto learning process. I have added the lines to register a new widget area in functions.php as follow:

    
    /**
     * Including the widget area.
     */
    function theme_widget_areas_init() {
        register_sidebar( array(
            'name'          => _('Topbar Left'),
            'id'            => 'topbar-left',
            'before_widget' => '',
            'after_widget'  => '',
            'before_title'  => '',
            'after_title'   => '',
        ) );
    }
    add_action( 'widgets_init', 'theme_widget_areas_init' );
    

    Also I have set and specific area within my index.php file for the sidebar.

    
    <?php if (is_active_sidebar('topbar-left')) :?>
        <?php dynamic_sidebar('topbar-left'); ?>
    <?php endif ?>
    

    Finally the issue is that my widget perfectly appears on the Appearance/Widget area and is active with a text widget just as a test, also the front-end side shows the widget with its content. However the Customize area does not show the widget area and instead displays the already pretty common text:

    Your theme has 1 widget area, but this particular page doesn’t display them.

    Well, so for consideration:

    • Yes, the template includes the wp_head() and wp_footer() tags.
    • Yes, I already checked the php error log and seems ok.
    • Yes, I am in the index in the Customize and is the page I placed the sidebar on, I know it because it shows me the actual widget but on the view, not in the options though.
    • I also have tried the Health Checker plugin and it showed Good and did not fix the issue either.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    Hey Oscar,

    I’m wondering if you have any active plugins?

    Can you try it with

    	'before_widget' => '<div class="%2$s">',
    	'after_widget'  => '</div>',

    so that the Customizer has a place to put its management classes? I’m not sure this is needed, but it would be a good test. The Customizer manipulates things in Javascript, not PHP.

    Thread Starter Oscar Contreras

    (@oscarcontreasnavas)

    Thanks for the replies to Jose and Joy. @jcastaneda No, I neither have any plugin active nor installed. I removed the ones that come by default with the fresh wordpress zip file.

    @joyously , thanks for the suggestion, I tried after you posted it but unfortunately the Customize has not changed. I checked the inspector element in google chrome and the new div wraps the widget like it is supposed to do, so nothing odd about it and the class in it is widget_text since is a Widget Text as I mentioned on the main question.

    It sounds like the only thing wrong is in Customizer. The Customizer is a lot of Javascript. Can you make sure there is nothing in the JS console for the Customizer widget section?

    Thread Starter Oscar Contreras

    (@oscarcontreasnavas)

    Perfect!

    @joyously that was a great suggestion from you! I checked the console and there was a problem with the jQuery library and some conflicts since I use loading one versión from Bootstrap CDN and the Customizer was trying with the wordpress’ default one.

    The solution, was just to comment (or remove) the jQuery related to Bootstrap and just let it use the one loaded by WordPress itself. I already check and there seems to be no problem with the CSS library so far. Then now, I think this has been resolved.

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Customize section does not show my widget area’ is closed to new replies.