mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-09 03:30:06 +00:00
Customize: Improve extensibility of Custom CSS.
* Add `customize_value_custom_css` filter to `WP_Customize_Custom_CSS::value()` method. * Introduce `customize_update_custom_css_post_content_args` filter in `WP_Customize_Custom_CSS::update()` method. * Make clear that `wp_get_custom_css()` and `wp_get_custom_css` filter are specifically for obtaining the value to render/display. Eliminate use of `wp_get_custom_css()` when getting the setting value. Use the underlying `post_value` directly when `is_previewed`. * Move anonymous functions handing JS previewing for `custom_logo`, `custom_css`, and `background` into named functions on the `wp.customize.settingPreviewHandlers` to allow plugins to override/extend preview logic. * Update `_custom_background_cb` to always print a `style` tag wen in the customizer preview, and update background preview logic to replace existing style element instead of appending a new style to the head so that background changes don't unexpectedly override any Custom CSS in the preview's stylesheet cascade. Props westonruter, georgestephanis. See #22058. Fixes #38672. git-svn-id: https://develop.svn.wordpress.org/trunk@39209 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1500,8 +1500,12 @@ function _custom_background_cb() {
|
||||
$color = false;
|
||||
}
|
||||
|
||||
if ( ! $background && ! $color )
|
||||
if ( ! $background && ! $color ) {
|
||||
if ( is_customize_preview() ) {
|
||||
echo '<style type="text/css" id="custom-background-css"></style>';
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$style = $color ? "background-color: #$color;" : '';
|
||||
|
||||
@@ -1621,7 +1625,7 @@ function wp_get_custom_css_post( $stylesheet = '' ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the saved Custom CSS content.
|
||||
* Fetch the saved Custom CSS content for rendering.
|
||||
*
|
||||
* @since 4.7.0
|
||||
* @access public
|
||||
|
||||
Reference in New Issue
Block a user