diff --git a/src/wp-admin/customize.php b/src/wp-admin/customize.php
index c8bd6e3..8b870bb 100644
a
|
b
|
do_action( 'customize_controls_print_scripts' ); |
224 | 224 | 'theme' => array( |
225 | 225 | 'stylesheet' => $wp_customize->get_stylesheet(), |
226 | 226 | 'active' => $wp_customize->is_theme_active(), |
| 227 | 'bgElement' => get_theme_support( 'custom-background', 'element-selector' ), |
| 228 | 'bgClass' => get_theme_support( 'custom-background', 'html-class' ), |
227 | 229 | ), |
228 | 230 | 'url' => array( |
229 | 231 | 'preview' => esc_url_raw( $url ? $url : home_url( '/' ) ), |
diff --git a/src/wp-includes/class-wp-customize-manager.php b/src/wp-includes/class-wp-customize-manager.php
index 8d78bdd..17976d0 100644
a
|
b
|
final class WP_Customize_Manager { |
594 | 594 | */ |
595 | 595 | public function customize_preview_settings() { |
596 | 596 | $settings = array( |
597 | | 'values' => array(), |
598 | | 'channel' => wp_unslash( $_POST['customize_messenger_channel'] ), |
599 | | 'activePanels' => array(), |
| 597 | 'values' => array(), |
| 598 | 'channel' => wp_unslash( $_POST['customize_messenger_channel'] ), |
| 599 | 'activePanels' => array(), |
600 | 600 | 'activeSections' => array(), |
601 | 601 | 'activeControls' => array(), |
| 602 | 'theme' => array( |
| 603 | 'bgElement' => get_theme_support( 'custom-background', 'element-selector' ), |
| 604 | 'bgClass' => get_theme_support( 'custom-background', 'html-class' ), |
| 605 | |
| 606 | ), |
602 | 607 | 'l10n' => array( |
603 | | 'loading' => __( 'Loading ...' ), |
| 608 | 'loading' => __( 'Loading ...' ), |
604 | 609 | ), |
605 | 610 | ); |
606 | 611 | |
diff --git a/src/wp-includes/js/customize-preview.js b/src/wp-includes/js/customize-preview.js
index e58c8d6..69a33a3 100644
a
|
b
|
|
131 | 131 | }); |
132 | 132 | |
133 | 133 | api.when.apply( api, bg ).done( function( color, image, position_x, repeat, attachment ) { |
134 | | var body = $(document.body), |
| 134 | var elementSelector = api.settings.theme.bgElement, |
| 135 | element = $(elementSelector), |
135 | 136 | head = $('head'), |
136 | 137 | style = $('#custom-background-css'), |
137 | 138 | update; |
138 | 139 | |
139 | 140 | update = function() { |
140 | 141 | var css = ''; |
| 142 | var bgClass = api.settings.theme.bgClass; |
| 143 | var selector = elementSelector + '.' + bgClass; |
141 | 144 | |
142 | 145 | // The body will support custom backgrounds if either |
143 | 146 | // the color or image are set. |
144 | 147 | // |
145 | 148 | // See get_body_class() in /wp-includes/post-template.php |
146 | | body.toggleClass( 'custom-background', !! ( color() || image() ) ); |
| 149 | element.toggleClass( bgClass, !! ( color() || image() ) ); |
147 | 150 | |
148 | 151 | if ( color() ) |
149 | 152 | css += 'background-color: ' + color() + ';'; |
… |
… |
|
157 | 160 | |
158 | 161 | // Refresh the stylesheet by removing and recreating it. |
159 | 162 | style.remove(); |
160 | | style = $('<style type="text/css" id="custom-background-css">body.custom-background { ' + css + ' }</style>').appendTo( head ); |
| 163 | style = $('<style type="text/css" id="custom-background-css">' + selector + ' { ' + css + ' }</style>').appendTo( head ); |
161 | 164 | }; |
162 | 165 | |
163 | 166 | $.each( arguments, function() { |
diff --git a/src/wp-includes/post-template.php b/src/wp-includes/post-template.php
index 2a6569f..a05583a 100644
a
|
b
|
function get_body_class( $class = '' ) { |
669 | 669 | } |
670 | 670 | |
671 | 671 | if ( get_background_color() !== get_theme_support( 'custom-background', 'default-color' ) || get_background_image() ) |
672 | | $classes[] = 'custom-background'; |
| 672 | $classes[] = get_theme_support( 'custom-background', 'html-class' ); |
673 | 673 | |
674 | 674 | $page = $wp_query->get( 'page' ); |
675 | 675 | |
diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php
index 1b372da..ee7de78 100644
a
|
b
|
function _custom_background_cb() { |
1356 | 1356 | |
1357 | 1357 | $style .= $image . $repeat . $position . $attachment; |
1358 | 1358 | } |
| 1359 | |
| 1360 | $element = get_theme_support( 'custom-background', 'element-selector' ); |
| 1361 | $html_class = get_theme_support( 'custom-background', 'html-class' ); |
| 1362 | $selector = $element . '.' . $html_class; |
1359 | 1363 | ?> |
1360 | 1364 | <style type="text/css" id="custom-background-css"> |
1361 | | body.custom-background { <?php echo trim( $style ); ?> } |
| 1365 | <?php echo $selector; ?> { <?php echo trim( $style ); ?> } |
1362 | 1366 | </style> |
1363 | 1367 | <?php |
1364 | 1368 | } |
… |
… |
function add_theme_support( $feature ) { |
1603 | 1607 | 'wp-head-callback' => '_custom_background_cb', |
1604 | 1608 | 'admin-head-callback' => '', |
1605 | 1609 | 'admin-preview-callback' => '', |
| 1610 | 'element-selector' => 'body', |
| 1611 | 'html-class' => 'custom-background' |
1606 | 1612 | ); |
1607 | 1613 | |
1608 | 1614 | $jit = isset( $args[0]['__jit'] ); |