Only 1 custom widget area displaying in customizer


Hi Thierry, I'm attempting to add some custom widget areas to my theme; though, while they show up in Admin > Appearance > Widgets, only the Footer Widgets area displays in the theme customizer Widgets section.

If i remove the footer widget code from below, it disappears as expected. The other disappears from the Appearance > Widgets page as expected, if removed, but never appears in the customizer.

Is there something additional that needs to be done, or have I perhaps done something incorrectly?

beans_add_action( 'tm_beans_child_widgets', 'widgets_init', 'beans_child_widgets_init' );

function beans_child_widgets_init() {

  beans_register_widget_area( array(
    'name'        => __( 'Blog Sidebar', 'beans-child' ),
   'id'          => 'blog-sidebar',
    'beans_type'  => 'list'
 ) );

  beans_register_widget_area( array(
    'name'        => __( 'Footer Widgets', 'beans-child' ),
   'id'          => 'footer-widgets',
    'beans_type'  => 'grid'
 ) );

}

I feel a bit foolish now. Didn't realize this, but when in the customizer preview, you need to be on the page that the custom widget area is displayed on in order for the section to appear in the customizer Widgets panel.

TL;DR

PEBKAC error πŸ˜‰


Hey Brad, welcome to Beans Community.

You are correct, the widget area has to be called on the page to have it available in the customizer πŸ˜‰

Happy coding,

Write a reply

Login or register to write a reply, it's free!