I am currently working on adding options to the theme customizer. For the last two hours I have been trying to get the live preview working and I am trying figure out why my theme isn't loading the theme-customizer.js
file needed for the live preview.
All of the options I have added to the theme-customizer work if I save it and then refresh the page. So I know it isn't an issue with the settings.
I currently have the hook to call the JS file within the customize.php
file along with all of the settings for the customizer. I also have a separate theme-enqueue.php
where I enqueue the other JS files for my theme.
Here is an example of the hook I am trying to call the JS file from within my customize.php
file:
function mytheme_customize_preview_js() {
wp_enqueue_script( 'mytheme-customizer', get_template_directory_uri() . '/js/theme-customizer.js', array( 'customize-preview' ), '20120187', true );
}
add_action( 'customize_preview_init', 'mytheme_customize_preview_js' );
When I check the loaded javascript files within chrome, it seems to load all of the ones I need except for this one. Can anyone shed some light on the situation?
theme-customizer.js
? That is not generally necessary for hooking into the Customize API.