- Timestamp:
- 11/12/2018 11:19:13 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.0/src/wp-content/themes/twentynineteen/functions.php
r43860 r43892 9 9 * @since 1.0.0 10 10 */ 11 12 /** 13 * Twenty Nineteen only works in WordPress 4.7 or later. 14 */ 15 if ( version_compare( $GLOBALS['wp_version'], '4.7', '<' ) ) { 16 require get_template_directory() . '/inc/back-compat.php'; 17 return; 18 } 11 19 12 20 if ( ! function_exists( 'twentynineteen_setup' ) ) : … … 49 57 register_nav_menus( 50 58 array( 51 'menu-1' => esc_html__( 'Primary', 'twentynineteen' ), 59 'menu-1' => __( 'Primary', 'twentynineteen' ), 60 'footer' => __( 'Footer Menu', 'twentynineteen' ), 52 61 'social' => __( 'Social Links Menu', 'twentynineteen' ), 53 62 ) … … 87 96 add_theme_support( 'customize-selective-refresh-widgets' ); 88 97 89 // Add support for Block Styles 98 // Add support for Block Styles. 90 99 add_theme_support( 'wp-block-styles' ); 91 100 … … 93 102 add_theme_support( 'align-wide' ); 94 103 95 // Add support for editor styles 104 // Add support for editor styles. 96 105 add_theme_support( 'editor-styles' ); 97 106 98 // Enqueue editor styles 107 // Enqueue editor styles. 99 108 add_editor_style( 'style-editor.css' ); 100 109 101 // Editor color palette 110 // Editor color palette. 102 111 add_theme_support( 103 112 'editor-color-palette', 104 113 array( 105 114 array( 106 'name' => esc_html__( 'Primary Color', 'twentynineteen' ),115 'name' => __( 'Primary Color', 'twentynineteen' ), 107 116 'slug' => 'primary', 108 117 'color' => twentynineteen_hsl_hex( 'default' === get_theme_mod( 'colorscheme' ) ? 199 : get_theme_mod( 'colorscheme_primary_hue', 199 ), 100, 33 ), … … 111 120 ); 112 121 113 // Add support for responsive embedded content 122 // Add support for responsive embedded content. 114 123 add_theme_support( 'responsive-embeds' ); 115 124 … … 145 154 * Priority 0 to make it available to lower priority callbacks. 146 155 * 147 * @global int $content_width 156 * @global int $content_width Content width. 148 157 */ 149 158 function twentynineteen_content_width() { … … 166 175 167 176 if ( has_nav_menu( 'menu-1' ) ) { 168 wp_enqueue_script( 'twentynineteen-touch-navigation', get_theme_file_uri( '/js/touch-navigation.js' ), array(), '1.0', true ); 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 ); 177 wp_enqueue_script( 'twentynineteen-priority-menu', get_theme_file_uri( '/js/priority-menu.js' ), array(), '1.0', true ); 178 wp_enqueue_script( 'twentynineteen-touch-navigation', get_theme_file_uri( '/js/touch-keyboard-navigation.js' ), array(), '1.0', true ); 172 179 } 173 180 174 181 wp_enqueue_style( 'twentynineteen-print-style', get_template_directory_uri() . '/print.css', array(), wp_get_theme()->get( 'Version' ), 'print' ); 175 176 if ( is_singular() && twentynineteen_can_show_post_thumbnail() ) {177 wp_add_inline_style( 'twentynineteen-style', twentynineteen_header_featured_image_css() );178 }179 182 180 183 if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { … … 185 188 186 189 /** 187 * Enqueue supplemental block editor styles 190 * Enqueue supplemental block editor styles. 188 191 */ 189 192 function twentynineteen_editor_customizer_styles() { … … 193 196 if ( 'custom' === get_theme_mod( 'colorscheme' ) ) { 194 197 // Include color patterns 195 require_once ( get_parent_theme_file_path( '/inc/color-patterns.php' ));198 require_once get_parent_theme_file_path( '/inc/color-patterns.php' ); 196 199 wp_add_inline_style( 'twentynineteen-editor-customizer-styles', twentynineteen_custom_colors_css() ); 197 200 } … … 204 207 function twentynineteen_colors_css_wrap() { 205 208 206 // Only include custom colors in customizer or frontend 207 if ( ( ! is_customize_preview() && is_admin() ) || is_admin() ) {209 // Only include custom colors in customizer or frontend. 210 if ( ( ! is_customize_preview() && 'default' === get_theme_mod( 'colorscheme', 'default' ) ) || is_admin() ) { 208 211 return; 209 212 } 210 213 211 require_once ( get_parent_theme_file_path( '/inc/color-patterns.php' ));214 require_once get_parent_theme_file_path( '/inc/color-patterns.php' ); 212 215 213 216 if ( 'default' === get_theme_mod( 'colorscheme', 'default' ) ) { … … 221 224 <?php echo twentynineteen_custom_colors_css(); ?> 222 225 </style> 223 <?php226 <?php 224 227 } 225 228 add_action( 'wp_head', 'twentynineteen_colors_css_wrap' );
Note: See TracChangeset
for help on using the changeset viewer.