- Timestamp:
- 11/19/2018 09:26:02 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.0/src/wp-content/themes/twentynineteen/inc/customizer.php
r43860 r43909 1 1 <?php 2 2 /** 3 * Twenty Nineteen ThemeCustomizer3 * Twenty Nineteen: Customizer 4 4 * 5 5 * @package WordPress … … 36 36 37 37 /** 38 * Custom colors.38 * Primary color. 39 39 */ 40 40 $wp_customize->add_setting( 41 ' colorscheme',41 'primary_color', 42 42 array( 43 43 'default' => 'default', … … 48 48 49 49 $wp_customize->add_control( 50 ' colorscheme',50 'primary_color', 51 51 array( 52 52 'type' => 'radio', 53 'label' => __( ' Color Scheme', 'twentynineteen' ),53 'label' => __( 'Primary Color', 'twentynineteen' ), 54 54 'choices' => array( 55 'default' => _x( 'Default', ' color scheme', 'twentynineteen' ),56 'custom' => _x( 'Custom', ' color scheme', 'twentynineteen' ),55 'default' => _x( 'Default', 'primary color', 'twentynineteen' ), 56 'custom' => _x( 'Custom', 'primary color', 'twentynineteen' ), 57 57 ), 58 58 'section' => 'colors', … … 61 61 ); 62 62 63 // Add primary color setting and control.63 // Add primary color hue setting and control. 64 64 $wp_customize->add_setting( 65 ' colorscheme_primary_hue',65 'primary_color_hue', 66 66 array( 67 67 'default' => 199, … … 74 74 new WP_Customize_Color_Control( 75 75 $wp_customize, 76 ' colorscheme_primary_hue',76 'primary_color_hue', 77 77 array( 78 'label' => __( 'Primary Color', 'twentynineteen' ), 79 'description' => __( 'Changes the Color of the Featured Image overlay, Buttons, Links etc.', 'twentynineteen' ), 78 'description' => __( 'Apply a custom color for buttons, links, featured images, etc.', 'twentynineteen' ), 80 79 'section' => 'colors', 81 80 'mode' => 'hue', … … 84 83 ); 85 84 85 // Add image filter setting and control. 86 86 $wp_customize->add_setting( 87 87 'image_filter', 88 88 array( 89 'default' => 'active',90 'sanitize_callback' => ' twentynineteen_sanitize_image_filter',89 'default' => 1, 90 'sanitize_callback' => 'absint', 91 91 'transport' => 'postMessage', 92 92 ) … … 96 96 'image_filter', 97 97 array( 98 'label' => __( 'Featured Image Color Filter', 'twentynineteen' ), 99 'section' => 'colors', 100 'type' => 'radio', 101 'description' => __( "Twenty Nineteen adds a color filter to featured images using your site's primary color. If you disable this effect, the theme will use a black filter in individual posts to keep text readable when it appears on top of the featured image.", 'twentynineteen' ) . '<br/><span style="font-style: normal; display: block; margin-top: 16px;">' . __( 'On Featured Images, apply', 'twentynineteen' ) . '</span>', 102 'choices' => array( 103 'active' => __( 'A color filter', 'twentynineteen' ), 104 'inactive' => __( 'A black filter', 'twentynineteen' ), 105 ), 98 'label' => __( 'Apply a filter to featured images using the primary color', 'twentynineteen' ), 99 'section' => 'colors', 100 'type' => 'checkbox', 106 101 ) 107 102 ); … … 144 139 145 140 /** 146 * Sanitize image filter choice.141 * Sanitize custom color choice. 147 142 * 148 143 * @param string $choice Whether image filter is active. … … 162 157 return 'default'; 163 158 } 164 /**165 * Sanitize image filter choice.166 *167 * @param string $choice Whether image filter is active.168 *169 * @return string170 */171 function twentynineteen_sanitize_image_filter( $choice ) {172 $valid = array(173 'active',174 'inactive',175 );176 177 if ( in_array( $choice, $valid, true ) ) {178 return $choice;179 }180 181 return 'active';182 }
Note: See TracChangeset
for help on using the changeset viewer.