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
api.create( 
    params.id, 
    params.id, 
    params.default, 
    params.args 
);

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

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

None of them seem to work as the section doesn't appear and I have to run wp.customize.section(sectionparams.id).activate() 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
11 views



Related Hot Questions



Government Jobs Opening


...