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.

Built from https://develop.svn.wordpress.org/trunk@38966


git-svn-id: http://core.svn.wordpress.org/trunk@38909 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
David A. Kennedy 2016-10-26 18:43:42 +00:00
parent 6fe17e2a3d
commit 834b7c608e
3 changed files with 35 additions and 1 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,

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.7-alpha-38965';
$wp_version = '4.7-alpha-38966';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.