diff --git a/src/wp-includes/class-wp-customize-manager.php b/src/wp-includes/class-wp-customize-manager.php
index 00c54c7..bcf6b85 100644
a
|
b
|
final class WP_Customize_Manager { |
1486 | 1486 | 'theme' => array( |
1487 | 1487 | 'stylesheet' => $this->get_stylesheet(), |
1488 | 1488 | 'active' => $this->is_theme_active(), |
| 1489 | 'bgElement' => get_theme_support( 'custom-background', 'background-element' ), |
| 1490 | 'bgClass' => get_theme_support( 'custom-background', 'background-class' ), |
| 1491 | 'bgSelector' => get_theme_support( 'custom-background', 'background-selector' ), |
1489 | 1492 | ), |
1490 | 1493 | 'url' => array( |
1491 | 1494 | 'preview' => esc_url_raw( $this->get_preview_url() ), |
… |
… |
final class WP_Customize_Manager { |
1511 | 1514 | 'documentTitleTmpl' => $this->get_document_title_template(), |
1512 | 1515 | ); |
1513 | 1516 | |
| 1517 | $settings['theme']['bgSelector'] = sprintf( $settings['theme']['bgSelector'], $settings['theme']['bgElement'], $settings['theme']['bgClass'] ); |
| 1518 | |
1514 | 1519 | // Prepare Customize Section objects to pass to JavaScript. |
1515 | 1520 | foreach ( $this->sections() as $id => $section ) { |
1516 | 1521 | if ( $section->check_capabilities() ) { |
diff --git a/src/wp-includes/js/customize-preview.js b/src/wp-includes/js/customize-preview.js
index 29341d7..f4af3c1 100644
a
|
b
|
|
137 | 137 | }); |
138 | 138 | |
139 | 139 | api.when.apply( api, bg ).done( function( color, image, position_x, repeat, attachment ) { |
140 | | var body = $(document.body), |
| 140 | var element = $(window.parent._wpCustomizeSettings.theme.bgElement), |
141 | 141 | head = $('head'), |
142 | 142 | style = $('#custom-background-css'), |
143 | 143 | update; |
144 | 144 | |
145 | 145 | update = function() { |
146 | 146 | var css = ''; |
| 147 | var selector = window.parent._wpCustomizeSettings.theme.bgSelector; |
147 | 148 | |
148 | 149 | // The body will support custom backgrounds if either |
149 | 150 | // the color or image are set. |
150 | 151 | // |
151 | 152 | // See get_body_class() in /wp-includes/post-template.php |
152 | | body.toggleClass( 'custom-background', !! ( color() || image() ) ); |
| 153 | element.toggleClass( 'custom-background', !! ( color() || image() ) ); |
153 | 154 | |
154 | 155 | if ( color() ) |
155 | 156 | css += 'background-color: ' + color() + ';'; |
… |
… |
|
163 | 164 | |
164 | 165 | // Refresh the stylesheet by removing and recreating it. |
165 | 166 | style.remove(); |
166 | | style = $('<style type="text/css" id="custom-background-css">body.custom-background { ' + css + ' }</style>').appendTo( head ); |
| 167 | style = $('<style type="text/css" id="custom-background-css">' + selector + ' { ' + css + ' }</style>').appendTo( head ); |
167 | 168 | }; |
168 | 169 | |
169 | 170 | $.each( arguments, function() { |
diff --git a/src/wp-includes/post-template.php b/src/wp-includes/post-template.php
index b296464..eae6a0b 100644
a
|
b
|
function get_body_class( $class = '' ) { |
678 | 678 | } |
679 | 679 | |
680 | 680 | if ( get_background_color() !== get_theme_support( 'custom-background', 'default-color' ) || get_background_image() ) |
681 | | $classes[] = 'custom-background'; |
| 681 | $classes[] = get_theme_support( 'custom-background', 'background-class' ); |
682 | 682 | |
683 | 683 | $page = $wp_query->get( 'page' ); |
684 | 684 | |
diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php
index 130b90e..33458cc 100644
a
|
b
|
function _custom_background_cb() { |
1293 | 1293 | |
1294 | 1294 | $style .= $image . $repeat . $position . $attachment; |
1295 | 1295 | } |
| 1296 | |
| 1297 | $element = get_theme_support( 'custom-background', 'background-element' ); |
| 1298 | $class = get_theme_support( 'custom-background', 'background-class' ); |
| 1299 | $selector = get_theme_support( 'custom-background', 'background-selector' ); |
| 1300 | |
| 1301 | |
| 1302 | $selector = sprintf( $selector, $element, $class ); |
1296 | 1303 | ?> |
1297 | 1304 | <style type="text/css" id="custom-background-css"> |
1298 | | body.custom-background { <?php echo trim( $style ); ?> } |
| 1305 | <?php echo $selector; ?> { <?php echo trim( $style ); ?> } |
1299 | 1306 | </style> |
1300 | 1307 | <?php |
1301 | 1308 | } |
… |
… |
function add_theme_support( $feature ) { |
1553 | 1560 | 'wp-head-callback' => '_custom_background_cb', |
1554 | 1561 | 'admin-head-callback' => '', |
1555 | 1562 | 'admin-preview-callback' => '', |
| 1563 | 'background-element' => 'body', |
| 1564 | 'background-class' => 'custom-background', |
| 1565 | 'background-selector' => '%1$s.%2$s', |
1556 | 1566 | ); |
1557 | 1567 | |
1558 | 1568 | $jit = isset( $args[0]['__jit'] ); |