From 1363813c6bb45fe77ec604e20a1845a345db22c7 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 7 Nov 2016 18:13:34 +0000 Subject: [PATCH] Customize: Move Custom CSS control `placeholder` help text to setting `default` value. The `WP_Customize_Custom_CSS_Setting::value()` method now returns the `default` if `wp_get_custom_css()` returns empty. Props westonruter, afercia, helen. See #35395. Fixes #38685. Built from https://develop.svn.wordpress.org/trunk@39151 git-svn-id: http://core.svn.wordpress.org/trunk@39091 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-customize-manager.php | 4 +--- .../customize/class-wp-customize-custom-css-setting.php | 6 +++++- wp-includes/version.php | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/wp-includes/class-wp-customize-manager.php b/wp-includes/class-wp-customize-manager.php index 206d9641bd..5a9770a676 100644 --- a/wp-includes/class-wp-customize-manager.php +++ b/wp-includes/class-wp-customize-manager.php @@ -3599,6 +3599,7 @@ final class WP_Customize_Manager { $custom_css_setting = new WP_Customize_Custom_CSS_Setting( $this, sprintf( 'custom_css[%s]', get_stylesheet() ), array( 'capability' => 'unfiltered_css', + 'default' => sprintf( "/*\n%s\n*/", __( "You can add your own CSS here.\n\nClick the help icon above to learn more." ) ), ) ); $this->add_setting( $custom_css_setting ); @@ -3606,9 +3607,6 @@ final class WP_Customize_Manager { 'type' => 'textarea', 'section' => 'custom_css', 'settings' => array( 'default' => $custom_css_setting->id ), - 'input_attrs' => array( - 'placeholder' => __( "/*\nYou can add your own CSS here.\n\nClick the help icon above to learn more.\n*/" ), - ) ) ); } diff --git a/wp-includes/customize/class-wp-customize-custom-css-setting.php b/wp-includes/customize/class-wp-customize-custom-css-setting.php index 2015458119..17e01fc6a5 100644 --- a/wp-includes/customize/class-wp-customize-custom-css-setting.php +++ b/wp-includes/customize/class-wp-customize-custom-css-setting.php @@ -128,7 +128,11 @@ final class WP_Customize_Custom_CSS_Setting extends WP_Customize_Setting { * @return string */ public function value() { - return wp_get_custom_css( $this->stylesheet ); + $value = wp_get_custom_css( $this->stylesheet ); + if ( empty( $value ) ) { + $value = $this->default; + } + return $value; } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index d934c047ae..3cb9a94a8a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-beta2-39150'; +$wp_version = '4.7-beta2-39151'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.