Ticket #29959: 29959.diff
| File 29959.diff, 4.0 KB (added by , 12 years ago) |
|---|
-
src/wp-content/themes/twentyfifteen/inc/class-twentyfifteen-customize-color-scheme-control.php
1 <?php 2 /** 3 * The Color Scheme Customizer control class. 4 * 5 * @package WordPress 6 * @subpackage Twenty_Fifteen 7 * @since Twenty Fifteen 1.0 8 */ 9 10 class Twentyfifteen_Customize_Color_Scheme_Control extends WP_Customize_Control { 11 public $type = 'colorScheme'; 12 13 function enqueue() { 14 wp_enqueue_script( 'color-scheme-control', get_template_directory_uri() . '/js/color-scheme-control.js', array( 'customize-controls' ), '', true ); 15 wp_localize_script( 'color-scheme-control', 'colorScheme', twentyfifteen_get_color_schemes() ); 16 } 17 18 public function render_content() { 19 if ( empty( $this->choices ) ) 20 return; 21 22 ?> 23 <label> 24 <?php if ( ! empty( $this->label ) ) : ?> 25 <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> 26 <?php endif; 27 if ( ! empty( $this->description ) ) : ?> 28 <span class="description customize-control-description"><?php echo $this->description; ?></span> 29 <?php endif; ?> 30 31 <select <?php $this->link(); ?>> 32 <?php 33 foreach ( $this->choices as $value => $label ) 34 echo '<option value="' . esc_attr( $value ) . '"' . selected( $this->value(), $value, false ) . '>' . $label . '</option>'; 35 ?> 36 </select> 37 </label> 38 <?php 39 } 40 } -
src/wp-content/themes/twentyfifteen/inc/customizer.php
15 15 * @param WP_Customize_Manager $wp_customize Theme Customizer object. 16 16 */ 17 17 function twentyfifteen_customize_register( $wp_customize ) { 18 // Load the Twentyfifteen_Customize_Color_Scheme_Control class. 19 require( 'class-twentyfifteen-customize-color-scheme-control.php' ); 20 18 21 $color_scheme = twentyfifteen_get_color_scheme(); 19 22 20 23 $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; … … 56 59 'section' => 'colors', 57 60 ) ) ); 58 61 } 59 add_action( 'customize_register', 'twentyfifteen_customize_register' , 11);62 add_action( 'customize_register', 'twentyfifteen_customize_register' ); 60 63 61 64 /** 62 * Custom control for Color Schemes63 *64 * @since Twenty Fifteen 1.065 */66 function twentyfifteen_customize_color_scheme_control() {67 class Twentyfifteen_Customize_Color_Scheme_Control extends WP_Customize_Control {68 public $type = 'colorScheme';69 70 function enqueue() {71 wp_enqueue_script( 'color-scheme-control', get_template_directory_uri() . '/js/color-scheme-control.js', array( 'customize-controls' ), '', true );72 wp_localize_script( 'color-scheme-control', 'colorScheme', twentyfifteen_get_color_schemes() );73 }74 75 public function render_content() {76 if ( empty( $this->choices ) )77 return;78 79 ?>80 <label>81 <?php if ( ! empty( $this->label ) ) : ?>82 <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>83 <?php endif;84 if ( ! empty( $this->description ) ) : ?>85 <span class="description customize-control-description"><?php echo $this->description; ?></span>86 <?php endif; ?>87 88 <select <?php $this->link(); ?>>89 <?php90 foreach ( $this->choices as $value => $label )91 echo '<option value="' . esc_attr( $value ) . '"' . selected( $this->value(), $value, false ) . '>' . $label . '</option>';92 ?>93 </select>94 </label>95 <?php96 }97 }98 }99 add_action( 'customize_register', 'twentyfifteen_customize_color_scheme_control', 10 );100 101 /**102 65 * Register color schemes for Twenty Fifteen. 103 66 * Can be filtered with twentyfifteen_color_schemes. 104 67 *
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)