Customize: Use selective refresh to preview changes to site title and tagline in core themes.

Fixes issue where `wptexturize` and other filters fail to apply when previewing changes via `postMessage` transport.

See #27355.
Fixes #33738.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36764 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2016-03-01 22:18:26 +00:00
parent f7ae358cc7
commit d691be2b2a
1 changed files with 37 additions and 0 deletions

View File

@ -480,9 +480,46 @@ function twentytwelve_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';
if ( isset( $wp_customize->selective_refresh ) ) {
$wp_customize->selective_refresh->add_partial( 'blogname', array(
'selector' => '.site-title > a',
'container_inclusive' => false,
'render_callback' => 'twentytwelve_customize_partial_blogname',
) );
$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
'selector' => '.site-description',
'container_inclusive' => false,
'render_callback' => 'twentytwelve_customize_partial_blogdescription',
) );
}
}
add_action( 'customize_register', 'twentytwelve_customize_register' );
/**
* Render the site title for the selective refresh partial.
*
* @since Twenty Twelve 2.0
* @see twentytwelve_customize_register()
*
* @return void
*/
function twentytwelve_customize_partial_blogname() {
bloginfo( 'name' );
}
/**
* Render the site tagline for the selective refresh partial.
*
* @since Twenty Twelve 2.0
* @see twentytwelve_customize_register()
*
* @return void
*/
function twentytwelve_customize_partial_blogdescription() {
bloginfo( 'description' );
}
/**
* Enqueue Javascript postMessage handlers for the Customizer.
*