Organizational Research By

Surprising Reserch Topic

Understanding WordPress Customizer JS API

It has been frustrating few days and I was unable to get the exact way to achieve this via JS API.

So far, this is some thing I am doing to make it happen but with no success:

// for Settings

// for controls
var controlConstructor = api.controlConstructor[controlparams.type];
var control = new controlConstructor(, {
    params: controlparams,
    previewer: api.previewer

 //for Sections
 var section = new api.Section(, { 
    params: sectionparams
api.section.add(, section );

None of them seem to work as the section doesn't appear and I have to run wp.customize.section( twice in console to make the section appear, the same is with control.

Sorry for my poor JS knowledge but any help would be appreciated. :)

asked May 16, 2015 in JAVASCRIPT by rajesh
0 votes

Related Hot Questions

1 Answer

0 votes
Adding Sections and settings to your theme is done in the functions.php file where you can add new settings and sections.

The JavaScript part that you are attempting to use is only used for the LIVE Preview section, when you are actually changing theme settings.
answered May 16, 2015 by rajesh