Expose the API publicly on window.wp.customize
- Source:
Classes
- BackgroundControl
- BackgroundPositionControl
- CodeEditorControl
- ColorControl
- Control
- CroppedImageControl
- DateTimeControl
- Element
- HeaderControl
- ImageControl
- Loader
- MediaControl
- Messenger
- Notification
- Notifications
- OuterSection
- OverlayNotification
- Panel
- Preview
- Previewer
- PreviewFrame
- PreviewLinkControl
- Section
- Setting
- SiteIconControl
- ThemeControl
- ThemesPanel
- ThemesSection
- UploadControl
- Value
- Values
- Container
- LockedNotification
Namespaces
Members
-
<protected, static> _lastSavedRevision :number
-
Last revision that was saved.
Type:
- number
- Since:
-
- 4.7.0
- Source:
-
<protected, static> _latestRevision :number
-
Current change count.
Type:
- number
- Since:
-
- 4.7.0
- Source:
-
<protected, static> _latestSettingRevisions :object
-
Latest revisions associated with the updated setting.
Type:
- object
- Since:
-
- 4.7.0
- Source:
-
<static> control :function
-
Collection of all registered controls.
Type:
- function
- Since:
-
- 3.4.0
- Source:
Examples
wp.customize.control.each( function( control ) { ... } );
control = wp.customize.control( 'background_color' );
hasControl = wp.customize.control.has( 'background_color' );
wp.customize.control( 'background_color', function( control ) { ... } );
promise = wp.customize.control( 'blogname', 'blogdescription' ); promise.done( function( titleControl, taglineControl ) { ... } );
wp.customize.control( 'blogname', 'blogdescription', function( titleControl, taglineControl ) { ... } );
value = wp.customize.control( 'background_color ').setting.get(); value = wp.customize( 'background_color' ).get(); // Same as above, since setting ID and control ID are the same.
wp.customize.control.add( new wp.customize.Control( 'other_blogname', { setting: 'blogname', type: 'text', label: 'Site title', section: 'other_site_identify' } ) );
wp.customize.control.remove( 'other_blogname' );
wp.customize.control.bind( 'add', function( addedControl ) { ... } )
wp.customize.control.bind( 'removed', function( removedControl ) { ... } )
-
<static> defaultConstructor
-
Change objects contained within the main customize object to Settings.
-
<static> notifications :function
-
Collection of all global notifications.
Type:
- function
- Since:
-
- 4.9.0
- Source:
- See:
-
- wp.customize.control for further examples of how to interact with wp.customize.Values instances.
Examples
exists = wp.customize.notifications.has( 'a_new_day_arrived' );
notification = wp.customize.notifications( 'a_new_day_arrived' );
wp.customize.notifications( 'a_new_day_arrived', function( notification ) { ... } );
wp.customize.notifications.add( new wp.customize.Notification( 'midnight_almost_here', { type: 'warning', message: 'Midnight has almost arrived!', dismissible: true } ) );
wp.customize.notifications.remove( 'a_new_day_arrived' );
-
<static> panel :function
-
Collection of all registered panels.
Type:
- function
- Since:
-
- 4.0.0
- Source:
- See:
-
- wp.customize.control for further examples of how to interact with wp.customize.Values instances.
Examples
wp.customize.panel.each( function( panel ) { ... } )
panel = wp.customize.panel( 'nav_menus' );
wp.customize.panel( 'dynamically_created', function( panel ) { panel.expand(); } );
-
<static> previewer
-
Initialize Previewer
-
<static> reflowPaneContents
-
Sort panels, sections, controls by priorities. Hide empty sections and panels.
- Since:
-
- 4.1.0
- Source:
-
<static> section :function
-
Collection of all registered sections.
Type:
- function
- Since:
-
- 3.4.0
- Source:
- See:
-
- wp.customize.control for further examples of how to interact with wp.customize.Values instances.
Examples
wp.customize.section.each( function( section ) { ... } )
section = wp.customize.section( 'title_tagline' )
wp.customize.section( 'dynamically_created', function( section ) { section.expand(); } );
Methods
-
<private, static> _handleSettingValidities(args)
-
Handle setting_validities in an error response for the customize-save request. Add notifications to the settings and focus on the first control that has an invalid setting.
Parameters:
Name Type Description args
object Properties
Name Type Argument Default Description settingValidities
object focusInvalidControl
boolean <optional>
false - Since:
-
- 4.6.0
- Source:
Returns:
- Type
- void
-
<static> dirtyValues( [options])
-
Get the dirty setting values.
Parameters:
Name Type Argument Description options
object <optional>
Options. Properties
Name Type Argument Default Description unsaved
boolean <optional>
false Whether only values not saved yet into a changeset will be returned (differential changes). - Since:
-
- 4.7.0
- Source:
Returns:
Dirty setting values.- Type
- object
-
<static> findControlsForSettings(settingIds)
-
Find all controls associated with the given settings.
Parameters:
Name Type Description settingIds
Array:.<string:> Setting IDs. - Since:
-
- 4.6.0
- Source:
Returns:
Mapping setting ids to arrays of controls.- Type
- object:.<string:, wp.customize.Control:>
-
<static> get()
-
Get all customize settings.
- Source:
Returns:
- Type
- object
-
<static> requestChangesetUpdate( [changes] [, args])
-
Request updates to the changeset.
Parameters:
Name Type Argument Description changes
object <optional>
Mapping of setting IDs to setting params each normally including a value property, or mapping to null. If not provided, then the changes will still be obtained from unsaved dirty settings. args
object <optional>
Additional options for the save request. Properties
Name Type Argument Default Description autosave
boolean <optional>
false Whether changes will be stored in autosave revision if the changeset has been promoted from an auto-draft. force
boolean <optional>
false Send request to update even when there are no changes to submit. This can be used to request the latest status of the changeset on the server. title
string <optional>
Title to update in the changeset. Optional. date
string <optional>
Date to update in the changeset. Optional. - Since:
-
- 4.7.0
- Source:
Returns:
Promise resolving with the response data.- Type
- jQuery.Promise
-
<static> setDocumentTitle(documentTitle)
-
Set the document title of the customizer.
Parameters:
Name Type Description documentTitle
string - Since:
-
- 4.1.0
- Source:
-
<inner> focus( [params])
-
Expand a panel, section, or control and focus on the first focusable element.
Parameters:
Name Type Argument Description params
Object <optional>
Properties
Name Type Argument Description completeCallback
function <optional>
- Since:
-
- 4.1.0
- Source:
Type Definitions
-
deferredControlsCallback(controls)
-
Callback for resolved controls.
Parameters:
Name Type Description controls
Array:.<wp.customize.Control:> Resolved controls. -
deferredNotificationsCallback(notifications)
-
Callback for resolved notifications.
Parameters:
Name Type Description notifications
Array:.<wp.customize.Notification:> Resolved notifications. -
deferredPanelsCallback(panels)
-
Callback for resolved panels.
Parameters:
Name Type Description panels
Array:.<wp.customize.Panel:> Resolved panels. -
deferredSectionsCallback(sections)
-
Callback for resolved sections.
Parameters:
Name Type Description sections
Array:.<wp.customize.Section:> Resolved sections.