- Timestamp:
- 10/30/2018 02:13:07 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.0/src/wp-content/themes/twentynineteen/functions.php
r43808 r43842 7 7 * @package WordPress 8 8 * @subpackage Twenty_Nineteen 9 * @since 1.0.0 9 10 */ 10 11 … … 68 69 ); 69 70 70 // Set up the WordPress core custom background feature.71 add_theme_support(72 'custom-background',73 apply_filters(74 'twentynineteen_custom_background_args',75 array(76 'default-color' => 'ffffff',77 'default-image' => '',78 )79 )80 );81 82 71 /** 83 72 * Add support for core custom logo. … … 107 96 add_editor_style( 'style-editor.css' ); 108 97 98 // Add custom color to the editor color palette 99 add_theme_support( 100 'editor-color-palette', 101 array( 102 array( 103 'name' => esc_html__( 'Primary Color', 'twentynineteen' ), 104 'slug' => 'primary', 105 'color' => twentynineteen_hsl_hex( absint( get_theme_mod( 'colorscheme_hue', 199 ) ), 100, 33 ), 106 ), 107 ) 108 ); 109 109 110 } 110 111 endif; 111 112 add_action( 'after_setup_theme', 'twentynineteen_setup' ); 113 114 /** 115 * Register widget area. 116 * 117 * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar 118 */ 119 function twentynineteen_widgets_init() { 120 121 register_sidebar( 122 array( 123 'name' => __( 'Footer 1', 'twentynineteen' ), 124 'id' => 'sidebar-1', 125 'description' => __( 'Add widgets here to appear in your footer.', 'twentynineteen' ), 126 'before_widget' => '<section id="%1$s" class="widget %2$s">', 127 'after_widget' => '</section>', 128 'before_title' => '<h2 class="widget-title">', 129 'after_title' => '</h2>', 130 ) 131 ); 132 133 } 134 add_action( 'widgets_init', 'twentynineteen_widgets_init' ); 112 135 113 136 /** … … 136 159 wp_enqueue_script( 'twentynineteen-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true ); 137 160 161 if ( has_nav_menu( 'menu-1' ) ) { 162 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 ); 168 138 169 wp_enqueue_style( 'twentynineteen-print-style', get_template_directory_uri() . '/print.css', array(), wp_get_theme()->get( 'Version' ), 'print' ); 139 170 … … 152 183 */ 153 184 function twentynineteen_editor_frame_styles() { 185 186 // Include color patterns 187 require_once( get_parent_theme_file_path( '/inc/color-patterns.php' ) ); 188 154 189 wp_enqueue_style( 'twentynineteen-editor-frame-styles', get_theme_file_uri( '/style-editor-frame.css' ), false, '1.0', 'all' ); 155 } 156 190 wp_add_inline_style( 'twentynineteen-editor-frame-styles', twentynineteen_custom_colors_css() ); 191 } 157 192 add_action( 'enqueue_block_editor_assets', 'twentynineteen_editor_frame_styles' ); 158 193 159 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 ) ); 204 ?> 205 206 <style type="text/css" id="custom-theme-colors" <?php echo is_customize_preview() ? 'data-hue="' . $hue . '"' : ''; ?>> 207 <?php echo twentynineteen_custom_colors_css(); ?> 208 </style> 209 <?php 210 } 211 add_action( 'wp_head', 'twentynineteen_colors_css_wrap' ); 212 213 /** 160 214 * SVG Icons class. 161 215 */
Note: See TracChangeset
for help on using the changeset viewer.