From c7f2b7a1ee9b08ce7c89146bfedd9237adb64622 Mon Sep 17 00:00:00 2001 From: obenland Date: Mon, 4 Mar 2013 16:13:56 -0800 Subject: [PATCH] _s: Enable live preview for Header Text Color in Customizer. Change also removes an !important declaration in Custom Header CSS rules. --- inc/custom-header.php | 2 +- inc/customizer.php | 7 ++++--- js/customizer.js | 6 ++++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/inc/custom-header.php b/inc/custom-header.php index a2d7bb07..aa4ba05c 100644 --- a/inc/custom-header.php +++ b/inc/custom-header.php @@ -119,7 +119,7 @@ function _s_header_style() { ?> .site-title a, .site-description { - color: # !important; + color: #; } diff --git a/inc/customizer.php b/inc/customizer.php index a9768532..cc58967e 100644 --- a/inc/customizer.php +++ b/inc/customizer.php @@ -14,8 +14,9 @@ * @since _s 1.2 */ function _s_customize_register( $wp_customize ) { - $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; - $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; + $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; + $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; + $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; } add_action( 'customize_register', '_s_customize_register' ); @@ -25,6 +26,6 @@ add_action( 'customize_register', '_s_customize_register' ); * @since _s 1.2 */ function _s_customize_preview_js() { - wp_enqueue_script( '_s_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20120827', true ); + wp_enqueue_script( '_s_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20130304', true ); } add_action( 'customize_preview_init', '_s_customize_preview_js' ); diff --git a/js/customizer.js b/js/customizer.js index df2a8f78..68f76ec3 100644 --- a/js/customizer.js +++ b/js/customizer.js @@ -16,4 +16,10 @@ $( '.site-description' ).text( to ); } ); } ); + // Header text color. + wp.customize( 'header_textcolor', function( value ) { + value.bind( function( to ) { + $( '.site-title a, .site-description' ).css( 'color', to ); + } ); + } ); } )( jQuery ); \ No newline at end of file