Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
WP customizer JS API issue
* Custom JavaScript functions for the customizer controls.
;(function (api) {
api.bind('ready', function () {
// Create theme options panel.
new api.Panel('hannover_theme_options', {
title: 'Theme Options',
// Add section.
new api.Section('hannover_example_section', {
title: 'Example Section',
panel: 'hannover_theme_options',
customizeAction: 'Customizing ▸ Theme Options'
// Add checkbox control.
new api.Control('hannover_example_control', {
setting: 'hannover_example_setting',
type: 'checkbox',
section: 'hannover_example_section',
label: 'Check this box to do something.'
* Enqueue script for custom customize control.
* File path: wp-content/themes/theme-name/js/customize-controls.js
function custom_customize_enqueue() {
wp_enqueue_script( 'customize-controls', get_template_directory_uri() . '/js/customize-controls.js', [], null, true);
add_action( 'customize_controls_enqueue_scripts', 'custom_customize_enqueue' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.