Changeset 20908
- Timestamp:
- 05/25/2012 06:41:22 PM (13 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-wp-customize-manager.php
r20863 r20908 650 650 'sanitize_callback' => 'sanitize_hexcolor', 651 651 'theme_supports' => 'custom-background', 652 'transport' => 'postMessage',653 652 ) ); 654 653 … … 717 716 ) ); 718 717 718 // If the theme is using the default background callback, we can update 719 // the background CSS using postMessage. 720 if ( get_theme_support( 'custom-background', 'wp-head-callback' ) === '_custom_background_cb' ) { 721 foreach ( array( 'color', 'image', 'position_x', 'repeat', 'attachment' ) as $prop ) { 722 $this->get_setting( 'background_' . $prop )->transport = 'postMessage'; 723 } 724 } 725 719 726 /* Nav Menus */ 720 727 -
trunk/wp-includes/js/customize-preview.dev.js
r20833 r20908 62 62 return; 63 63 64 var preview, b ody;64 var preview, bg; 65 65 66 66 preview = new api.Preview( window.location.href ); … … 76 76 }); 77 77 78 body = $(document.body); 79 // Auto update background color by default 80 api( 'background_color', function( value ) { 81 value.bind( function( to ) { 82 body.css( 'background-color', to ? '#' + to : '' ); 78 /* Custom Backgrounds */ 79 bg = $.map(['color', 'image', 'position_x', 'repeat', 'attachment'], function( prop ) { 80 return 'background_' + prop; 81 }); 82 83 api.when.apply( api, bg ).done( function( color, image, position_x, repeat, attachment ) { 84 var style = $('#custom-background-css'), 85 update; 86 87 if ( ! style.length ) 88 return; 89 90 update = function() { 91 var css = ''; 92 93 if ( color() ) 94 css += 'background-color: #' + color() + ';'; 95 96 if ( image() ) { 97 css += 'background-image: url("' + image() + '");'; 98 css += 'background-position: top ' + position_x() + ';'; 99 css += 'background-repeat: ' + repeat() + ';'; 100 css += 'background-position: top ' + attachment() + ';'; 101 } 102 103 style.html( 'body.custom-background { ' + css + ' }' ); 104 }; 105 106 $.each( arguments, function() { 107 this.bind( update ); 83 108 }); 84 109 }); -
trunk/wp-includes/theme.php
r20901 r20908 1131 1131 } 1132 1132 ?> 1133 <style type="text/css" >1133 <style type="text/css" id="custom-background-css"> 1134 1134 body.custom-background { <?php echo trim( $style ); ?> } 1135 1135 </style>
Note: See TracChangeset
for help on using the changeset viewer.