javascript - Understanding WordPress Customizer JS API -


okay have been trying educate myself create new panels sections , controls dynamically using wordpress customizer's js api.

it has been frustrating few days , unable exact way achieve via js api.

so far, thing doing make happen no success:

// settings api.create(      params.id,      params.id,      params.default,      params.args  );  // 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 work section doesn't appear , have run wp.customize.section(sectionparams.id).activate() twice in console make section appear, same control.

sorry poor js knowledge appreciated. :)

read documentation js api

you can find advanced examples in plugin


Comments