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:
parent
94b59e7f0d
commit
f78775a6db
|
@ -510,6 +510,19 @@ function twentyeleven_customize_register( $wp_customize ) {
|
|||
$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' => 'twentyeleven_customize_partial_blogname',
|
||||
) );
|
||||
$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
|
||||
'selector' => '#site-description',
|
||||
'container_inclusive' => false,
|
||||
'render_callback' => 'twentyeleven_customize_partial_blogdescription',
|
||||
) );
|
||||
}
|
||||
|
||||
$options = twentyeleven_get_theme_options();
|
||||
$defaults = twentyeleven_get_default_theme_options();
|
||||
|
||||
|
@ -574,6 +587,30 @@ function twentyeleven_customize_register( $wp_customize ) {
|
|||
}
|
||||
add_action( 'customize_register', 'twentyeleven_customize_register' );
|
||||
|
||||
/**
|
||||
* Render the site title for the selective refresh partial.
|
||||
*
|
||||
* @since Twenty Eleven 2.4
|
||||
* @see twentyeleven_customize_register()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function twentyeleven_customize_partial_blogname() {
|
||||
bloginfo( 'name' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the site tagline for the selective refresh partial.
|
||||
*
|
||||
* @since Twenty Eleven 2.4
|
||||
* @see twentyeleven_customize_register()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function twentyeleven_customize_partial_blogdescription() {
|
||||
bloginfo( 'description' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind JS handlers to make Customizer preview reload changes asynchronously.
|
||||
*
|
||||
|
|
|
@ -20,6 +20,19 @@ function twentyfifteen_customize_register( $wp_customize ) {
|
|||
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
|
||||
$wp_customize->get_setting( 'blogdescription' )->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' => 'twentyfifteen_customize_partial_blogname',
|
||||
) );
|
||||
$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
|
||||
'selector' => '.site-description',
|
||||
'container_inclusive' => false,
|
||||
'render_callback' => 'twentyfifteen_customize_partial_blogdescription',
|
||||
) );
|
||||
}
|
||||
|
||||
// Add color scheme setting and control.
|
||||
$wp_customize->add_setting( 'color_scheme', array(
|
||||
'default' => 'default',
|
||||
|
@ -69,6 +82,30 @@ function twentyfifteen_customize_register( $wp_customize ) {
|
|||
}
|
||||
add_action( 'customize_register', 'twentyfifteen_customize_register', 11 );
|
||||
|
||||
/**
|
||||
* Render the site title for the selective refresh partial.
|
||||
*
|
||||
* @since Twenty Fifteen 1.5
|
||||
* @see twentyfifteen_customize_register()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function twentyfifteen_customize_partial_blogname() {
|
||||
bloginfo( 'name' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the site tagline for the selective refresh partial.
|
||||
*
|
||||
* @since Twenty Fifteen 1.5
|
||||
* @see twentyfifteen_customize_register()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function twentyfifteen_customize_partial_blogdescription() {
|
||||
bloginfo( 'description' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register color schemes for Twenty Fifteen.
|
||||
*
|
||||
|
|
|
@ -20,6 +20,19 @@ function twentyfourteen_customize_register( $wp_customize ) {
|
|||
$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' => 'twentyfourteen_customize_partial_blogname',
|
||||
) );
|
||||
$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
|
||||
'selector' => '.site-description',
|
||||
'container_inclusive' => false,
|
||||
'render_callback' => 'twentyfourteen_customize_partial_blogdescription',
|
||||
) );
|
||||
}
|
||||
|
||||
// Rename the label to "Site Title Color" because this only affects the site title in this theme.
|
||||
$wp_customize->get_control( 'header_textcolor' )->label = __( 'Site Title Color', 'twentyfourteen' );
|
||||
|
||||
|
@ -64,6 +77,30 @@ function twentyfourteen_customize_register( $wp_customize ) {
|
|||
}
|
||||
add_action( 'customize_register', 'twentyfourteen_customize_register' );
|
||||
|
||||
/**
|
||||
* Render the site title for the selective refresh partial.
|
||||
*
|
||||
* @since Twenty Fourteen 1.7
|
||||
* @see twentyfourteen_customize_register()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function twentyfourteen_customize_partial_blogname() {
|
||||
bloginfo( 'name' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the site tagline for the selective refresh partial.
|
||||
*
|
||||
* @since Twenty Fourteen 1.7
|
||||
* @see twentyfourteen_customize_register()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function twentyfourteen_customize_partial_blogdescription() {
|
||||
bloginfo( 'description' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize the Featured Content layout value.
|
||||
*
|
||||
|
|
|
@ -535,9 +535,46 @@ function twentythirteen_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',
|
||||
'container_inclusive' => false,
|
||||
'render_callback' => 'twentythirteen_customize_partial_blogname',
|
||||
) );
|
||||
$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
|
||||
'selector' => '.site-description',
|
||||
'container_inclusive' => false,
|
||||
'render_callback' => 'twentythirteen_customize_partial_blogdescription',
|
||||
) );
|
||||
}
|
||||
}
|
||||
add_action( 'customize_register', 'twentythirteen_customize_register' );
|
||||
|
||||
/**
|
||||
* Render the site title for the selective refresh partial.
|
||||
*
|
||||
* @since Twenty Thirteen 1.9
|
||||
* @see twentythirteen_customize_register()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function twentythirteen_customize_partial_blogname() {
|
||||
bloginfo( 'name' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the site tagline for the selective refresh partial.
|
||||
*
|
||||
* @since Twenty Thirteen 1.9
|
||||
* @see twentythirteen_customize_register()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function twentythirteen_customize_partial_blogdescription() {
|
||||
bloginfo( 'description' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue Javascript postMessage handlers for the Customizer.
|
||||
*
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.5-beta1-36796';
|
||||
$wp_version = '4.5-beta1-36797';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue