Add Control in Widgets Sub-Panel in Customizer

admin2025-01-07  4

Is it possible to add controls to sub panels of the widgets panel in the customizer? If yes, how do I address them? The widget area would be named “top-widget-area”

Neither addressing:

'panel' => 'widgets-top-widget-area'

nor

'section' => 'widgets-top-widget-area'

in $wp_customize->add_control work.

Do you have an idea?

Is it possible to add controls to sub panels of the widgets panel in the customizer? If yes, how do I address them? The widget area would be named “top-widget-area”

Neither addressing:

'panel' => 'widgets-top-widget-area'

nor

'section' => 'widgets-top-widget-area'

in $wp_customize->add_control work.

Do you have an idea?

Share Improve this question edited Dec 28, 2016 at 21:51 Jami Gibbs 7694 silver badges13 bronze badges asked Dec 28, 2016 at 20:47 richwprichwp 12 bronze badges 3
  • Needing some clarification: You're wanting to add controls to the panel that lists the sidebar areas? Or you mean the panel before that? – Jami Gibbs Commented Dec 28, 2016 at 22:08
  • Hi @jami0821, Directly into the panel for a specific widget area. For example I want to add a control to the bespoken "top-widget-area" to define how many columns it should have. – richwp Commented Dec 29, 2016 at 8:34
  • WP-Admin » Customizer » Widgets Panel » Top Widget Area – richwp Commented Dec 29, 2016 at 8:37
Add a comment  | 

2 Answers 2

Reset to default 0

Turns out the section would be addressed with 'section' => 'sidebar-widgets-top-widget-area' ... so you need the sidebar-widgets- in front of the widget area name.

However, since it is the widgets panel, everything except the widget areas active on the page your are at are set to display: none; and need to be set to: display: block !important;

@richwp , I asked a similar question and got a detailed answer from Weston Ruter, who actually works on the Widgets customizer panel in core. He created a writeup, a video, and a github repo with source code in order to answer my question (which was an awesome thing to do). Here is the link to the writeup he did: [link]https://make.xwp.co/2017/02/08/adding-meta-fields-to-a-widget-sidebar-section-in-the-customizer/

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736264785a994.html

最新回复(0)