_s: Enable live preview for Header Text Color in Customizer. Change also

removes an !important declaration in Custom Header CSS rules.
This commit is contained in:
obenland 2013-03-04 16:13:56 -08:00
parent 9fe1b0d8a8
commit c7f2b7a1ee
3 changed files with 11 additions and 4 deletions

View File

@ -119,7 +119,7 @@ function _s_header_style() {
?> ?>
.site-title a, .site-title a,
.site-description { .site-description {
color: #<?php echo get_header_textcolor(); ?> !important; color: #<?php echo get_header_textcolor(); ?>;
} }
<?php endif; ?> <?php endif; ?>
</style> </style>

View File

@ -16,6 +16,7 @@
function _s_customize_register( $wp_customize ) { function _s_customize_register( $wp_customize ) {
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
} }
add_action( 'customize_register', '_s_customize_register' ); add_action( 'customize_register', '_s_customize_register' );
@ -25,6 +26,6 @@ add_action( 'customize_register', '_s_customize_register' );
* @since _s 1.2 * @since _s 1.2
*/ */
function _s_customize_preview_js() { 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' ); add_action( 'customize_preview_init', '_s_customize_preview_js' );

View File

@ -16,4 +16,10 @@
$( '.site-description' ).text( to ); $( '.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 ); } )( jQuery );