Twenty Eleven: add postMessage support for header_textcolor to improve the user experience in the Customizer.

Fixes #24128, props kovshenin, jcastaneda, and lancewillett. 
Built from https://develop.svn.wordpress.org/trunk@31971


git-svn-id: http://core.svn.wordpress.org/trunk@31950 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Lance Willett 2015-04-01 21:42:27 +00:00
parent 5b9c7c412a
commit 8f6f787d13
5 changed files with 26 additions and 4 deletions

View File

@ -251,7 +251,7 @@ function twentyeleven_header_style() {
?>
#site-title,
#site-description {
position: absolute !important;
position: absolute;
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px, 1px, 1px, 1px);
}
@ -261,7 +261,7 @@ function twentyeleven_header_style() {
?>
#site-title a,
#site-description {
color: #<?php echo $text_color; ?> !important;
color: #<?php echo $text_color; ?>;
}
<?php endif; ?>
</style>

View File

@ -9,4 +9,22 @@
$( '#site-description' ).text( to );
} );
} );
// Header text color
wp.customize( 'header_textcolor', function( value ) {
value.bind( function( to ) {
if ( 'blank' === to ) {
$( '#site-title, #site-title a, #site-description' ).css( {
'clip': 'rect(1px, 1px, 1px, 1px)',
'position': 'absolute'
} );
} else {
$( '#site-title, #site-title a, #site-description' ).css( {
'clip': 'auto',
'color': to,
'position': 'relative'
} );
}
} );
} );
} )( jQuery );

View File

@ -508,6 +508,7 @@ add_filter( 'body_class', 'twentyeleven_layout_classes' );
function twentyeleven_customize_register( $wp_customize ) {
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
$options = twentyeleven_get_theme_options();
$defaults = twentyeleven_get_default_theme_options();
@ -581,6 +582,6 @@ add_action( 'customize_register', 'twentyeleven_customize_register' );
* @since Twenty Eleven 1.3
*/
function twentyeleven_customize_preview_js() {
wp_enqueue_script( 'twentyeleven-customizer', get_template_directory_uri() . '/inc/theme-customizer.js', array( 'customize-preview' ), '20120523', true );
wp_enqueue_script( 'twentyeleven-customizer', get_template_directory_uri() . '/inc/theme-customizer.js', array( 'customize-preview' ), '20150401', true );
}
add_action( 'customize_preview_init', 'twentyeleven_customize_preview_js' );

View File

@ -2452,6 +2452,9 @@ p.comment-form-comment {
#access ul {
font-size: 12px;
}
#branding .only-search + #access div {
padding-right: 0;
}
article.intro .entry-content {
font-size: 12px;
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.2-beta3-31970';
$wp_version = '4.2-beta3-31971';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.