diff --git a/wp-admin/custom-background.php b/wp-admin/custom-background.php index 06b2a1e0f..e79649518 100644 --- a/wp-admin/custom-background.php +++ b/wp-admin/custom-background.php @@ -207,15 +207,15 @@ if ( $bgcolor = get_background_color() ) if ( get_background_image() ) { // background-image URL must be single quote, see below - $background_styles .= ' background-image: url(\'' . set_url_scheme( get_theme_mod('background_image_thumb', '') ) . '\');' + $background_styles .= ' background-image: url(\'' . set_url_scheme( get_theme_mod( 'background_image_thumb', get_background_image() ) ) . '\');' . ' background-repeat: ' . get_theme_mod('background_repeat', 'repeat') . ';' . ' background-position: top ' . get_theme_mod('background_position_x', 'left'); } ?>
-
- +
+
@@ -322,9 +322,10 @@ if ( get_background_image() ) {
- + - class="hide-if-no-js" id="clearcolor"> () + class="hide-if-no-js" id="clearcolor"> () +
diff --git a/wp-admin/js/custom-background.dev.js b/wp-admin/js/custom-background.dev.js index b4dbc6657..e5a56dcf1 100644 --- a/wp-admin/js/custom-background.dev.js +++ b/wp-admin/js/custom-background.dev.js @@ -1,55 +1,63 @@ -var farbtastic; +var farbtastic, pickColor; -function pickColor(color) { - farbtastic.setColor(color); - jQuery('#background-color').val(color); - jQuery('#custom-background-image').css('background-color', color); - if ( color && color !== '#' ) - jQuery('#clearcolor').show(); - else - jQuery('#clearcolor').hide(); -} +(function($) { -jQuery(document).ready(function() { - jQuery('#pickcolor').click(function() { - jQuery('#colorPickerDiv').show(); - return false; - }); + pickColor = function(color, cleared) { + farbtastic.setColor(color); + $('#background-color').val(color); + $('#custom-background-image').css('background-color', color); + console.log( color ); + if ( typeof cleared === 'undefined' ) + cleared = ! color || color === '#'; + if ( cleared ) + $('#clearcolor').hide(); + else + $('#clearcolor').show(); + } - jQuery('#clearcolor a').click( function(e) { - pickColor(''); - e.preventDefault(); - }); - - jQuery('#background-color').keyup(function() { - var _hex = jQuery('#background-color').val(), hex = _hex; - if ( hex.charAt(0) != '#' ) - hex = '#' + hex; - hex = hex.replace(/[^#a-fA-F0-9]+/, ''); - if ( hex != _hex ) - jQuery('#background-color').val(hex); - if ( hex.length == 4 || hex.length == 7 ) - pickColor( hex ); - }); - - jQuery('input[name="background-position-x"]').change(function() { - jQuery('#custom-background-image').css('background-position', jQuery(this).val() + ' top'); - }); - - jQuery('input[name="background-repeat"]').change(function() { - jQuery('#custom-background-image').css('background-repeat', jQuery(this).val()); - }); - - farbtastic = jQuery.farbtastic('#colorPickerDiv', function(color) { - pickColor(color); - }); - pickColor(jQuery('#background-color').val()); - - jQuery(document).mousedown(function(){ - jQuery('#colorPickerDiv').each(function(){ - var display = jQuery(this).css('display'); - if ( display == 'block' ) - jQuery(this).fadeOut(2); + $(document).ready(function() { + + $('#pickcolor').click(function() { + $('#colorPickerDiv').show(); + return false; + }); + + $('#clearcolor a').click( function(e) { + pickColor( $('#defaultcolor').val(), true ); + e.preventDefault(); + }); + + $('#background-color').keyup(function() { + var _hex = $('#background-color').val(), hex = _hex; + if ( hex.charAt(0) != '#' ) + hex = '#' + hex; + hex = hex.replace(/[^#a-fA-F0-9]+/, ''); + if ( hex != _hex ) + $('#background-color').val(hex); + if ( hex.length == 4 || hex.length == 7 ) + pickColor( hex ); + }); + + $('input[name="background-position-x"]').change(function() { + $('#custom-background-image').css('background-position', $(this).val() + ' top'); + }); + + $('input[name="background-repeat"]').change(function() { + $('#custom-background-image').css('background-repeat', $(this).val()); + }); + + farbtastic = $.farbtastic('#colorPickerDiv', function(color) { + pickColor(color); + }); + pickColor($('#background-color').val()); + + $(document).mousedown(function(){ + $('#colorPickerDiv').each(function(){ + var display = $(this).css('display'); + if ( display == 'block' ) + $(this).fadeOut(2); + }); }); }); -}); + +})(jQuery); \ No newline at end of file diff --git a/wp-includes/theme.php b/wp-includes/theme.php index 8bbf799a8..8ca429078 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -1501,7 +1501,8 @@ function current_theme_supports( $feature ) { break; case 'custom-header': - // specific custom header capabilities can be registered by passing + case 'custom-background' : + // specific custom header and background capabilities can be registered by passing // an array to add_theme_support() $header_support = $args[0]; return ( isset( $_wp_theme_features[$feature][0][$header_support] ) && $_wp_theme_features[$feature][0][$header_support] );