0

I must add custom classes to the customizer panels, sections and controls. I checked the WP Codex, but I didn't find any information. How to do it?

1

The customizer is rendered by several classes. Let's look, for instance, at panels, which are generated by a function called render_template in the file WordPress Customize Panel class. As you can see the function hardcodes the html. You might be able to manipulate the json object from which a part of the class variables is taken, but I wouldn't count on it. In any case you're not supposed to mess with this, as indicated by the function being 'protected', and doing so might lead to unexpected results.

So, there is no native way to do what you want.

That said, you can of course go around this by adding a script file to the customizer, which adds classes to certain panels/sections/controls on the user end.

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.