0

So I have a widget area that, in v4.0, is burried in a dropdown within the secondary Widgets panel on the Customize panel page.

Because it's the only widget area it feels rather silly being burried so deeply, so I'm wondering if there's a way to override the nesting and make that widget area dropdown a top-level section like it was in v3.x?

It looks like this was brought up by the Core team here, but didn't gain any traction.

Does anyone know how I might be able to do this?

1

Got it.

Admittedly, this feels hacky but seems to do the job just fine.

In my existing customize_register hook I set the following:

// Retreive the widget section in the Theme Customizer
// We need to cast the return of get_section to an object
// "the_widgets_section" in get_section is the ID of the registered widget area
$widget_area = (object) $wp_customize->get_section( 'sidebar-widgets-the_widgets_section' )
// The value of panel will be 'widgets', so we set it back to '' (top level panel)
$widget_area->panel = '';
// If you're so inclined, we can change the title of it as well.
$widget_area->title = __( 'My Widgets', 'textdomain' );

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.