From 5907ac8e4b77ce9c2b8f48f642b28d6135cbb55e Mon Sep 17 00:00:00 2001 From: Lance Willett Date: Fri, 1 Mar 2013 17:45:59 +0000 Subject: [PATCH] Twenty Twelve: enable live preview for Header Text Color in Theme Customizer. Change also removes an `!important` declaration (yay) in Custom Header CSS rules. Props SriniG, fixes #23600. git-svn-id: http://core.svn.wordpress.org/trunk@23572 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- functions.php | 5 +++-- inc/custom-header.php | 6 +++--- js/theme-customizer.js | 6 ++++++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/functions.php b/functions.php index 7f050f1a3..f08d5a793 100644 --- a/functions.php +++ b/functions.php @@ -437,8 +437,9 @@ add_action( 'template_redirect', 'twentytwelve_content_width' ); * @return void */ function twentytwelve_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', 'twentytwelve_customize_register' ); diff --git a/inc/custom-header.php b/inc/custom-header.php index f94d0e8f7..37c1d3d77 100644 --- a/inc/custom-header.php +++ b/inc/custom-header.php @@ -77,9 +77,9 @@ function twentytwelve_header_style() { // If the user has set a custom color for the text, use that. else : ?> - .site-title a, - .site-description { - color: # !important; + .site-header h1 a, + .site-header h2 { + color: #; } diff --git a/js/theme-customizer.js b/js/theme-customizer.js index 1275d494b..578ec371f 100644 --- a/js/theme-customizer.js +++ b/js/theme-customizer.js @@ -17,6 +17,12 @@ $( '.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 ); + } ); + } ); // Hook into background color/image change and adjust body class value as needed. wp.customize( 'background_color', function( value ) {