- Timestamp:
- 11/02/2018 11:52:16 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.0/src/wp-content/themes/twentynineteen/functions.php
r43842 r43860 84 84 ); 85 85 86 // Add theme support for selective refresh for widgets. 87 add_theme_support( 'customize-selective-refresh-widgets' ); 88 86 89 // Add support for Block Styles 87 90 add_theme_support( 'wp-block-styles' ); … … 96 99 add_editor_style( 'style-editor.css' ); 97 100 98 // Add custom color to the editor color palette101 // Editor color palette 99 102 add_theme_support( 100 'editor-color-palette',103 'editor-color-palette', 101 104 array( 102 105 array( 103 106 'name' => esc_html__( 'Primary Color', 'twentynineteen' ), 104 107 'slug' => 'primary', 105 'color' => twentynineteen_hsl_hex( absint( get_theme_mod( 'colorscheme_hue', 199 )), 100, 33 ),108 'color' => twentynineteen_hsl_hex( 'default' === get_theme_mod( 'colorscheme' ) ? 199 : get_theme_mod( 'colorscheme_primary_hue', 199 ), 100, 33 ), 106 109 ), 107 110 ) 108 111 ); 112 113 // Add support for responsive embedded content 114 add_theme_support( 'responsive-embeds' ); 109 115 110 116 } … … 121 127 register_sidebar( 122 128 array( 123 'name' => __( 'Footer 1', 'twentynineteen' ),129 'name' => __( 'Footer', 'twentynineteen' ), 124 130 'id' => 'sidebar-1', 125 131 'description' => __( 'Add widgets here to appear in your footer.', 'twentynineteen' ), … … 161 167 if ( has_nav_menu( 'menu-1' ) ) { 162 168 wp_enqueue_script( 'twentynineteen-touch-navigation', get_theme_file_uri( '/js/touch-navigation.js' ), array(), '1.0', true ); 163 $twentynineteen_l10n['expand'] = __( 'Expand child menu', 'twentynineteen' ); 164 $twentynineteen_l10n['collapse'] = __( 'Collapse child menu', 'twentynineteen' ); 165 } 166 167 wp_localize_script( 'twentynineteen-skip-link-focus-fix', 'twentynineteenScreenReaderText', $twentynineteen_l10n ); 169 $l10n_skip_link_focus_fix['expand'] = __( 'Expand child menu', 'twentynineteen' ); 170 $l10n_skip_link_focus_fix['collapse'] = __( 'Collapse child menu', 'twentynineteen' ); 171 wp_localize_script( 'twentynineteen-skip-link-focus-fix', 'twentynineteenScreenReaderText', $l10n_skip_link_focus_fix ); 172 } 168 173 169 174 wp_enqueue_style( 'twentynineteen-print-style', get_template_directory_uri() . '/print.css', array(), wp_get_theme()->get( 'Version' ), 'print' ); … … 182 187 * Enqueue supplemental block editor styles 183 188 */ 184 function twentynineteen_editor_frame_styles() { 185 186 // Include color patterns 189 function twentynineteen_editor_customizer_styles() { 190 191 wp_enqueue_style( 'twentynineteen-editor-customizer-styles', get_theme_file_uri( '/style-editor-customizer.css' ), false, '1.0', 'all' ); 192 193 if ( 'custom' === get_theme_mod( 'colorscheme' ) ) { 194 // Include color patterns 195 require_once( get_parent_theme_file_path( '/inc/color-patterns.php' ) ); 196 wp_add_inline_style( 'twentynineteen-editor-customizer-styles', twentynineteen_custom_colors_css() ); 197 } 198 } 199 add_action( 'enqueue_block_editor_assets', 'twentynineteen_editor_customizer_styles' ); 200 201 /** 202 * Display custom color CSS in customizer and on frontend. 203 */ 204 function twentynineteen_colors_css_wrap() { 205 206 // Only include custom colors in customizer or frontend 207 if ( ( ! is_customize_preview() && is_admin() ) || is_admin() ) { 208 return; 209 } 210 187 211 require_once( get_parent_theme_file_path( '/inc/color-patterns.php' ) ); 188 212 189 wp_enqueue_style( 'twentynineteen-editor-frame-styles', get_theme_file_uri( '/style-editor-frame.css' ), false, '1.0', 'all' ); 190 wp_add_inline_style( 'twentynineteen-editor-frame-styles', twentynineteen_custom_colors_css() ); 191 } 192 add_action( 'enqueue_block_editor_assets', 'twentynineteen_editor_frame_styles' ); 193 194 /** 195 * Display custom color CSS in customizer and on frontend. 196 */ 197 function twentynineteen_colors_css_wrap() { 198 if ( 'custom' !== get_theme_mod( 'colorscheme' ) && ! is_customize_preview() ) { 199 return; 200 } 201 202 require_once( get_parent_theme_file_path( '/inc/color-patterns.php' ) ); 203 $hue = absint( get_theme_mod( 'colorscheme_hue', 250 ) ); 213 if ( 'default' === get_theme_mod( 'colorscheme', 'default' ) ) { 214 $primary_color = 199; 215 } else { 216 $primary_color = absint( get_theme_mod( 'colorscheme_primary_hue', 199 ) ); 217 } 204 218 ?> 205 219 206 <style type="text/css" id="custom-theme-colors" <?php echo is_customize_preview() ? 'data-hue="' . $ hue. '"' : ''; ?>>220 <style type="text/css" id="custom-theme-colors" <?php echo is_customize_preview() ? 'data-hue="' . $primary_color . '"' : ''; ?>> 207 221 <?php echo twentynineteen_custom_colors_css(); ?> 208 222 </style>
Note: See TracChangeset
for help on using the changeset viewer.