0

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:

<?php
/**
 * 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.
0

Thanks to the wordpress forums, some grateful one just helped me finding the answer. So If you come here looking for a solution. Please first try the options I put in the post before, they did not work for me but they did for other users, so give them a try first.

If for some reason, just like me, you still have problems with the Customizer then open your console in google chrome and check for errors in javascript because as Joy suggested it to me here the Customizer has a lot of JS and specially uses jQuery.

To summarize, I could fix the problem by removing my calling to jQuery for Bootstrap in my theme and let it just use the default one in wordpress. So far, there has been no problem with the CSS library so I hope this is done.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.