1

I am just getting into using the theme customizer in WordPress. I found a great answer on this site about adding a slider and I got it working just fine. I was reading in the codex about the theme-customizer and it says that after you add your settings, you need to add to the theme-customizer.js file to update your settings. Does this really need to be done? I noticed that without adding my settings to this file that the slider images that I just got working seem to work just fine. So I am a little confused on this step. I can't even find the information that the codex is talking about in the default theme.

If you check "Step Two" in this link You will see that it is talking about adding a bunch of javascript to the theme. I don't see that it is needed. Things seem to update just fine without adding any javascript.

Even with these settings. The codex says that this stage is optional. I have added 3 photo uploads for a slider. Just to test out the customizer. The theme updates in real time without adding this kind of information about my new controls

$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
$wp_customize->get_setting( 'background_color' )->transport = 'postMessage';
2
  • Could you link to instructions you are talking about? There seems to be no such script in WordPress core.
    – Rarst
    Commented Nov 17, 2013 at 16:43
  • I have edited my question to include the link and a little more information
    – Jamie
    Commented Nov 17, 2013 at 20:04

1 Answer 1

1

It's not a necessary step but it is ideal. Adding the javascript is necessary to enable live-reloading within the Theme Customizer.

What this does is, when you alter a control, albeit a textbox, colorwheel, image upload, whatever. After the adjustment is made, if you have enabled live-reload, then a moment later the preview will refresh and display the change.

If you do not have the javascript built out and live reload setup then the adjustments will not be displayed until the user saves their changes and refreshes the page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.