Changeset 20913
- Timestamp:
- 05/25/2012 08:26:25 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/ajax-actions.php
r20888 r20913 1641 1641 } 1642 1642 1643 if ( isset( $post_data['context'] ) && isset( $post_data['theme'] ) ) { 1644 if ( 'custom-background' === $post_data['context'] ) 1645 update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', $post_data['theme'] ); 1646 1647 if ( 'custom-header' === $post_data['context'] ) 1648 update_post_meta( $attachment_id, '_wp_attachment_is_custom_header', $post_data['theme'] ); 1649 } 1650 1643 1651 $post = get_post( $attachment_id ); 1644 1652 -
trunk/wp-includes/class-wp-customize-control.php
r20912 r20913 399 399 <?php 400 400 } 401 402 public function print_tab_image( $url, $thumbnail_url = null ) { 403 $url = set_url_scheme( $url ); 404 $thumbnail_url = ( $thumbnail_url ) ? set_url_scheme( $thumbnail_url ) : $url; 405 ?> 406 <a href="#" class="thumbnail" data-customize-image-value="<?php echo esc_url( $url ); ?>"> 407 <img src="<?php echo esc_url( $thumbnail_url ); ?>" /> 408 </a> 409 <?php 410 } 411 } 412 413 class WP_Customize_Background_Image_Control extends WP_Customize_Image_Control { 414 public function __construct( $manager ) { 415 parent::__construct( $manager, 'background_image', array( 416 'label' => __( 'Background Image' ), 417 'section' => 'background_image', 418 'context' => 'custom-background', 419 'get_url' => 'get_background_image', 420 ) ); 421 422 if ( $this->setting->default ) 423 $this->add_tab( 'default', __('Default'), array( $this, 'tab_default_background' ) ); 424 } 425 426 public function tab_uploaded() { 427 $backgrounds = get_posts( array( 428 'post_type' => 'attachment', 429 'meta_key' => '_wp_attachment_is_custom_background', 430 'meta_value' => $this->manager->get_stylesheet(), 431 'orderby' => 'none', 432 'nopaging' => true, 433 ) ); 434 435 ?><div class="uploaded-target"></div><?php 436 437 if ( empty( $backgrounds ) ) 438 return; 439 440 foreach ( (array) $backgrounds as $background ) 441 $this->print_tab_image( esc_url_raw( $background->guid ) ); 442 } 443 444 public function tab_default_background() { 445 $this->print_tab_image( $this->setting->default ); 446 } 401 447 } 402 448 … … 425 471 ?><div class="uploaded-target"></div><?php 426 472 427 foreach ( $headers as $header ) : ?> 428 <a href="#" class="thumbnail" data-customize-image-value="<?php echo esc_url( $header['url'] ); ?>"> 429 <img src="<?php echo esc_url( set_url_scheme( $header['thumbnail_url'] ) ); ?>" /> 430 </a> 431 <?php endforeach; 473 foreach ( $headers as $header ) 474 $this->print_tab_image( $header['url'], $header['thumbnail_url'] ); 432 475 } 433 476 … … 436 479 $custom_image_header->process_default_headers(); 437 480 438 foreach ( $custom_image_header->default_headers as $header ) : ?> 439 <a href="#" class="thumbnail" data-customize-image-value="<?php echo esc_url( $header['url'] ); ?>"> 440 <img src="<?php echo esc_url( set_url_scheme( $header['thumbnail_url'] ) ); ?>" /> 441 </a> 442 <?php endforeach; 443 } 444 } 481 foreach ( $custom_image_header->default_headers as $header ) 482 $this->print_tab_image( $header['url'], $header['thumbnail_url'] ); 483 } 484 } -
trunk/wp-includes/class-wp-customize-manager.php
r20912 r20913 699 699 ) ); 700 700 701 $this->add_control( new WP_Customize_Image_Control( $this, 'background_image', array( 702 'label' => __( 'Background Image' ), 703 'section' => 'background_image', 704 'context' => 'custom-background', 705 ) ) ); 701 $this->add_control( new WP_Customize_Background_Image_Control( $this ) ); 706 702 707 703 $this->add_setting( 'background_repeat', array( -
trunk/wp-includes/js/customize-controls.dev.js
r20899 r20913 159 159 if ( this.params.context ) 160 160 control.uploader.param( 'post_data[context]', this.params.context ); 161 162 control.uploader.param( 'post_data[theme]', api.settings.theme.stylesheet ); 161 163 }, 162 164 success: function( attachment ) {
Note: See TracChangeset
for help on using the changeset viewer.