Twenty Seventeen: Fix a PHP warning on fresh installs.

When setting the `transport` parameter on Customizer settings, we need to ensure the setting exists, particularly on new sites.

See #38372.


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


git-svn-id: http://core.svn.wordpress.org/trunk@38780 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast 2016-10-20 09:04:31 +00:00
parent e51531a425
commit 35186cff65
2 changed files with 9 additions and 5 deletions

View File

@ -1,4 +1,4 @@
<?php <?php
/** /**
* Twenty Seventeen: Theme Customizer * Twenty Seventeen: Theme Customizer
* *
@ -13,9 +13,13 @@
* @param WP_Customize_Manager $wp_customize Theme Customizer object. * @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/ */
function twentyseventeen_customize_register( $wp_customize ) { function twentyseventeen_customize_register( $wp_customize ) {
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; $postMessage_settings = array( 'blogname', 'blogdescription', 'header_textcolor' );
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; foreach( $postMessage_settings as $postMessage_setting ) {
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; $setting = $wp_customize->get_setting( $postMessage_setting );
if ( $setting ) {
$setting->transport = 'postMessage';
}
}
/** /**
* Custom colors. * Custom colors.

View File

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