Contents
- 1 What is the postMessage API for the Customizer?
- 2 How does the wp.customize.value instance work?
- 3 Where can I find the Customizer JavaScript API?
- 4 Why is my customizer preview not loading properly?
- 5 What is the theme Customization API in WordPress?
- 6 Where can I find the WordPress theme customizer API?
What is the postMessage API for the Customizer?
The customizer app is currently split into two distinct areas: the customizer controls “pane” and the customize preview. The preview is currently in an iframe, meaning that all JS runs either in the controls pane or in the preview. The postMessage API is used to communicate between the preview and the controls.
How does the wp.customize.value instance work?
Control, Panel, and Section instances have an active state (a wp.customize.Value instance). When the active state changes, the panel, section, and control instances invoke their respective onChangeActive method, which by default slides the container element up and down, if false and true respectively.
How to use the Customizer in WordPress core?
This is used in WordPress core to add a link on the widgets admin page to link directly to the widgets panel within the customizer, as well as to connect visible edit shortcuts in the customize preview with the associated controls in the customize pane. When registering a panel, section, or control in PHP, you can supply a priority parameter.
Where can I find the Customizer JavaScript API?
There are wp.customize.Control, wp.customize.Panel, and wp.customize.Section models, as well as wp.customize.panel, wp.customize.section, and wp.customize.control collections (yes, they are singular) that store all control instances. You can iterate over panels, sections, and controls via:
Why is my customizer preview not loading properly?
A plugin conflict can cause Customizer preview to stop loading or part of it to stop working properly. If you have a cache plugin or server cache. You need to purge it’s cache contents and disable it. Clear your browser history and visit your Appearance -> Customize to see if it works. Re-activate back one plugin at a time.
Do you use JavaScript in the customize preview?
Most themes only implement JavaScript in the customize preview, and use it to implement instant previewing of settings via postMessage.
What is the theme Customization API in WordPress?
The Theme Customization API, added in WordPress 3.4, allows developers to customize and add controls to the “Appearance” → “Customize” admin screen. The Theme Customization screen (i.e. “Theme Customizer”) allows site admins to tweak a theme’s settings, color scheme or widgets, and see a preview of those changes in real time.
Where can I find the WordPress theme customizer API?
For more up-to-date, detailed information about the Customizer API, please see the new official documentation in the theme handbook: https://developer.wordpress.org/themes/customize-api/ . The Theme Customization API, added in WordPress 3.4, allows developers to customize and add controls to the “Appearance” → “Customize” admin screen.
Where is the JavaScript API in WordPress 4.1?
In WordPress 4.1, newly-expanded JavaScript APIs were introduced for all customizer objects. The entire JavaScript API is currently located in a single file, wp-admin/js/customize-controls.js, which contains models for all objects, core custom controls, and more.