Ticket #12186: background-repeat2.diff
File background-repeat2.diff, 6.2 KB (added by , 15 years ago) |
---|
-
wp-includes/theme.php
1440 1440 if ( !$background && !$color ) 1441 1441 return; 1442 1442 1443 $repeat = get_theme_mod('background_repeat', 'repeat'); 1444 if ( 'no-repeat' == $repeat ) 1445 $repeat = 'background-repeat: no-repeat;'; 1446 else 1447 $repeat = 'background-repeat: repeat;'; 1448 $position = get_theme_mod('background_position', 'left'); 1449 if ( 'center' == $position ) 1450 $position = 'background-position: top center;'; 1451 elseif ( 'right' == $position ) 1452 $position = 'background-position: top right;'; 1453 else 1454 $position = 'background-position: top left;'; 1455 $attachment = get_theme_mod('background_attachment', 'fixed'); 1456 if ( 'scroll' == $attachment ) 1443 switch( get_theme_mod('background_repeat', 'repeat') ) { 1444 1445 case 'no-repeat': 1446 $repeat = 'background-repeat: no-repeat;'; 1447 break; 1448 case 'repeat-x'; 1449 $repeat = 'background-repeat: repeat-x;'; 1450 break; 1451 case 'repeat-y': 1452 $repeat = 'background-repeat: repeat-y;'; 1453 break; 1454 default: 1455 $repeat = 'background-repeat: repeat;'; 1456 } 1457 1458 switch ( get_theme_mod('background_position', 'left') ) { 1459 case 'center': 1460 $position = 'background-position: top center;'; 1461 break; 1462 case 'right': 1463 $position = 'background-position: top right;'; 1464 break; 1465 default: 1466 $position = 'background-position: top left;'; 1467 } 1468 1469 if ( 'scroll' == get_theme_mod('background_attachment', 'fixed') ) 1457 1470 $attachment = 'background-attachment: scroll;'; 1458 1471 else 1459 1472 $attachment = 'background-attachment: fixed;'; … … 1463 1476 else 1464 1477 $image = ''; 1465 1478 1466 if ( !empty($background ) )1467 $image = "background-image: url('$background');";1468 else1469 $image = '';1470 1471 1479 if ( !empty($color) ) 1472 1480 $color = "background-color: #$color;"; 1473 1481 else -
wp-admin/js/custom-background.dev.js
22 22 pickColor( hex ); 23 23 }); 24 24 jQuery('input[name="background-position"]').change(function() { 25 jQuery('#custom-background-image').css(' text-align',jQuery(this).val());25 jQuery('#custom-background-image').css('background-position', 'top '+jQuery(this).val()); 26 26 }); 27 27 jQuery('select[name="background-repeat"]').change(function() { 28 jQuery('#custom-background-image').css('background-repeat', jQuery(this).val()); 29 }); 30 28 31 farbtastic = jQuery.farbtastic('#colorPickerDiv', function(color) { 29 32 pickColor(color); 30 33 }); -
wp-admin/css/wp-admin.dev.css
3662 3662 3663 3663 div#custom-background-image img { 3664 3664 max-width: 400px; 3665 max-height: 200px;3665 max-height: 300px; 3666 3666 } 3667 3667 3668 3668 /* Custom Header */ -
wp-admin/custom-background.php
98 98 } 99 99 100 100 if ( isset($_POST['background-repeat']) ) { 101 if ( in_array($_POST['background-repeat'], array('repeat', 'no-repeat' )) )101 if ( in_array($_POST['background-repeat'], array('repeat', 'no-repeat', 'repeat-x', 'repeat-y')) ) 102 102 $repeat = $_POST['background-repeat']; 103 103 else 104 104 $repeat = 'repeat'; … … 149 149 if ( $this->admin_image_div_callback ) { 150 150 call_user_func($this->admin_image_div_callback); 151 151 } else { 152 if ( $bgcolor = get_background_color() ) 153 $bgcolor = 'background-color: #' . $bgcolor . ';'; 152 ?> 154 153 155 if ( $align = get_theme_mod('background_position', 'left') ) 156 $align = "text-align: $align;"; 157 ?> 158 <div id="custom-background-image" style="<?php echo $bgcolor, $align ?>"> 154 <style type="text/css"> 155 #custom-background-image { 156 background-color: #<?=get_background_color()?>; 157 <?php if ( get_background_image() ) { ?> 158 background: url(<?=get_theme_mod('background_image_thumb', '')?>); 159 background-repeat: <?=get_theme_mod('background_repeat', 'no-repeat')?>; 160 background-position: top <?=get_theme_mod('background_position', 'left')?>; 161 background-attachment: <?=get_theme_mod('background_position', 'fixed')?>; 162 <?php } ?> 163 } 164 </style> 165 <div id="custom-background-image"> 159 166 <?php if ( get_background_image() ) { ?> 160 <img class="custom-background-image" src="<? php background_image(); ?>" />167 <img class="custom-background-image" src="<?=get_theme_mod('background_image_thumb', '')?>" style="visibility:hidden;" /> 161 168 <?php } ?> 162 169 <br class="clear" /> 163 170 </div> … … 192 199 193 200 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Repeat' ); ?></span></legend> 194 201 <label> 195 <input name="background-repeat" type="radio" value="no-repeat" <?php checked('no-repeat', get_theme_mod('background_repeat', 'repeat')); ?> /> 196 <?php _e('No repeat') ?> 202 <select name="background-repeat"> 203 <option value="no-repeat" <?php selected('no-repeat', get_theme_mod('background_repeat', 'repeat')); ?> ><?php _e('No repeat') ?></option> 204 <option value="repeat" <?php selected('repeat', get_theme_mod('background_repeat', 'repeat')); ?>><?php _e('Tile') ?></option> 205 <option value="repeat-x" <?php selected('repeat-x', get_theme_mod('background_repeat', 'repeat')); ?>><?php _e('Tile Horizontally') ?></option> 206 <option value="repeat-y" <?php selected('repeat-y', get_theme_mod('background_repeat', 'repeat')); ?>><?php _e('Tile Vertically') ?></option> 207 </select> 197 208 </label> 198 <label>199 <input name="background-repeat" type="radio" value="repeat" <?php checked('repeat', get_theme_mod('background_repeat', 'repeat')); ?> />200 <?php _e('Tile') ?>201 </label>202 209 </fieldset></td> 203 210 204 211 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Attachment' ); ?></span></legend> … … 286 293 wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); 287 294 288 295 set_theme_mod('background_image', esc_url($url)); 296 297 $thumbnail = wp_get_attachment_image_src( $id, 'thumbnail' ); 298 set_theme_mod('background_image_thumb', esc_url( $thumbnail[0] ) ); 299 289 300 do_action('wp_create_file_in_uploads', $file, $id); // For replication 290 301 $this->updated = true; 291 302 }