diff --git src/wp-includes/class-wp-customize-manager.php src/wp-includes/class-wp-customize-manager.php
index 206d964..f96a4b7 100644
|
|
|
final class WP_Customize_Manager {
|
| 3599 | 3599 | |
| 3600 | 3600 | $custom_css_setting = new WP_Customize_Custom_CSS_Setting( $this, sprintf( 'custom_css[%s]', get_stylesheet() ), array( |
| 3601 | 3601 | 'capability' => 'unfiltered_css', |
| | 3602 | 'default' => __( "/*\nYou can add your own CSS here.\n\nClick the help icon above to learn more.\n*/" ), |
| 3602 | 3603 | ) ); |
| 3603 | 3604 | $this->add_setting( $custom_css_setting ); |
| 3604 | 3605 | |
| … |
… |
final class WP_Customize_Manager {
|
| 3606 | 3607 | 'type' => 'textarea', |
| 3607 | 3608 | 'section' => 'custom_css', |
| 3608 | 3609 | 'settings' => array( 'default' => $custom_css_setting->id ), |
| 3609 | | 'input_attrs' => array( |
| 3610 | | 'placeholder' => __( "/*\nYou can add your own CSS here.\n\nClick the help icon above to learn more.\n*/" ), |
| 3611 | | ) |
| 3612 | 3610 | ) ); |
| 3613 | 3611 | } |
| 3614 | 3612 | |
diff --git src/wp-includes/customize/class-wp-customize-custom-css-setting.php src/wp-includes/customize/class-wp-customize-custom-css-setting.php
index 2015458..17e01fc 100644
|
|
|
final class WP_Customize_Custom_CSS_Setting extends WP_Customize_Setting {
|
| 128 | 128 | * @return string |
| 129 | 129 | */ |
| 130 | 130 | public function value() { |
| 131 | | return wp_get_custom_css( $this->stylesheet ); |
| | 131 | $value = wp_get_custom_css( $this->stylesheet ); |
| | 132 | if ( empty( $value ) ) { |
| | 133 | $value = $this->default; |
| | 134 | } |
| | 135 | return $value; |
| 132 | 136 | } |
| 133 | 137 | |
| 134 | 138 | /** |
diff --git tests/phpunit/tests/customize/custom-css-setting.php tests/phpunit/tests/customize/custom-css-setting.php
index d1d2a18..138f3a0 100644
|
|
|
class Test_WP_Customize_Custom_CSS_Setting extends WP_UnitTestCase {
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | | * Test WP_Customize_Custom_CSS_Setting::update(). |
| | 104 | * Test crud methods on WP_Customize_Custom_CSS_Setting. |
| 105 | 105 | * |
| 106 | 106 | * @covers wp_get_custom_css() |
| 107 | 107 | * @covers WP_Customize_Custom_CSS_Setting::value() |
| … |
… |
class Test_WP_Customize_Custom_CSS_Setting extends WP_UnitTestCase {
|
| 109 | 109 | * @covers WP_Customize_Custom_CSS_Setting::update() |
| 110 | 110 | */ |
| 111 | 111 | function test_crud() { |
| | 112 | |
| | 113 | $this->setting->default = '/* Hello World */'; |
| | 114 | $this->assertEquals( $this->setting->default, $this->setting->value() ); |
| | 115 | |
| 112 | 116 | $original_css = 'body { color: black; }'; |
| 113 | 117 | $this->factory()->post->create( array( |
| 114 | 118 | 'post_title' => $this->setting->stylesheet, |