Get any control/section/panel by passing the id of it.

wp.customize.control( controlId ); wp.customize.section( sectionId ); wp.customize.panel( panelId ); 

Iterate all  panel, sections and controls

wp.customize.panel.each( function ( panel, panelId ) { /* ... */ } ); wp.customize.section.each( function ( section, sectionId ) { /* ... */ } ); wp.customize.control.each( function ( control, controlId ) { /* ... */ …

Get any control/section/panel by passing the id of it.

wp.customize.control( controlId );
wp.customize.section( sectionId );
wp.customize.panel( panelId );

Iterate all  panel, sections and controls

wp.customize.panel.each( function ( panel, panelId ) { /* ... */ } );
wp.customize.section.each( function ( section, sectionId ) { /* ... */ } );
wp.customize.control.each( function ( control, controlId ) { /* ... */ } );
// To get all settings
wp.customize.each( function( setting ) { /* ... */ } );

Get all sections or controls of a given panel or section

wp.customize.panel( 'widgets' ).sections();
wp.customize.section( 'title_tagline' ).controls();
// To iterate in loop
_.each( wp.customize.section( 'title_tagline' ).controls(), function ( control ) {
  control.section( 'nav' );
});

Get sectionId/panelId of a given control/section

wp.customize.control( 'blogname' ).section(); // => title_tagline
wp.customize.section( 'sidebar-widgets-sidebar-1' ).panel(); // => widgets

Move control from one section to another

wp.customize.control( 'blogname' ).section( 'nav' );

Activate/Deactivate controls

wp.customize.section( 'nav' ).deactivate(); // slide up
wp.customize.section( 'nav' ).activate({ duration: 1000 }); …

Thanks for reading this short excerpt from the paid post! Fancy buying it to read all of it?

Read now, pay later

This article
Customizer Javascript API Quick Reference
0.29
USD

24-Hour Pass
24 hours access to all content on this website
0.99
USD
1 Month Subscription
1 month access to all content on this website (cancellable anytime)
1.99
USD
Powered by

Leave a Reply

Your email address will not be published. Required fields are marked *