From f657f831adf2fc7a2bd4bc3eaecdc42ce8fc9545 Mon Sep 17 00:00:00 2001 From: Stef Kariotidis Date: Tue, 15 Nov 2016 12:01:55 +0200 Subject: [PATCH] add support for title live preview in customizer --- js/customizer.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 js/customizer.js diff --git a/js/customizer.js b/js/customizer.js new file mode 100644 index 0000000..ade58a4 --- /dev/null +++ b/js/customizer.js @@ -0,0 +1,20 @@ + +/** + * This file adds some LIVE to the Theme Customizer live preview. To leverage + * this, set your custom settings to 'postMessage' and then add your handling + * here. Your javascript should grab settings from customizer controls, and + * then make any necessary changes to the page using jQuery. + * + * @see https://codex.wordpress.org/Theme_Customization_API#Part_3:_Configure_Live_Preview_.28Optional.29 + */ +( function( $ ) { + + // Update the site title in real time... + wp.customize( 'blogname', function( value ) { + value.bind( function( newval ) { + console.log(newval); + $( '.navbar-header a' ).html( newval ); + } ); + } ); + +} )( jQuery );