Twenty Seventeen: Implement selective refresh for site title and tagline

Adding the `opacity` property to the site title prevents opacity from changing during selective refreshes in the Customizer preview.

Props celloexpressions.

Fixes #38513.


git-svn-id: https://develop.svn.wordpress.org/trunk@38966 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
David A. Kennedy 2016-10-26 18:42:44 +00:00
parent 29e75c5d77
commit 67420e4986
2 changed files with 34 additions and 0 deletions

View File

@ -17,6 +17,15 @@ function twentyseventeen_customize_register( $wp_customize ) {
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
$wp_customize->selective_refresh->add_partial( 'blogname', array(
'selector' => '.site-title a',
'render_callback' => 'twentyseventeen_customize_partial_blogname',
) );
$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
'selector' => '.site-description',
'render_callback' => 'twentyseventeen_customize_partial_blogdescription',
) );
/**
* Custom colors.
*/
@ -189,6 +198,30 @@ function twentyseventeen_sanitize_colorscheme( $input ) {
return 'light';
}
/**
* Render the site title for the selective refresh partial.
*
* @since Twenty Seventeen 1.0
* @see twentyseventeen_customize_register()
*
* @return void
*/
function twentyseventeen_customize_partial_blogname() {
bloginfo( 'name' );
}
/**
* Render the site tagline for the selective refresh partial.
*
* @since Twenty Seventeen 1.0
* @see twentyseventeen_customize_register()
*
* @return void
*/
function twentyseventeen_customize_partial_blogdescription() {
bloginfo( 'description' );
}
/**
* Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
*/

View File

@ -1567,6 +1567,7 @@ body {
.site-title,
.site-title a {
color: #222;
opacity: 1; /* Prevent opacity from changing during selective refreshes in the customize preview */
}
body.has-header-image .site-title,