Merge pull request #130 from stef-k/customizer-title-live-preview-support

add support for title live preview in customizer - Thx @stef-k
This commit is contained in:
Holger 2016-11-15 11:40:53 +01:00 committed by GitHub
commit 54ac599779
1 changed files with 20 additions and 0 deletions

20
js/customizer.js Normal file
View File

@ -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 );