- Timestamp:
- 11/19/2021 08:12:44 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentytwentytwo/functions.php
r52164 r52222 104 104 font-style: normal; 105 105 font-stretch: normal; 106 font-display: swap; 106 107 src: url('" . get_theme_file_uri( 'assets/fonts/SourceSerif4Variable-Roman.ttf.woff2' ) . "') format('woff2'); 107 108 } … … 112 113 font-style: italic; 113 114 font-stretch: normal; 115 font-display: swap; 114 116 src: url('" . get_theme_file_uri( 'assets/fonts/SourceSerif4Variable-Italic.ttf.woff2' ) . "') format('woff2'); 115 117 } … … 120 122 endif; 121 123 124 if ( ! function_exists( 'twentytwentytwo_preload_webfonts' ) ) : 125 126 /** 127 * Preloads the main web font to improve performance. 128 * 129 * Only the main web font (font-style: normal) is preloaded here since that font is always relevant (e.g. it used 130 * on every heading). The other font is only needed if there is any applicable content in italic style, and 131 * therefore preloading it would in most cases regress performance when that font would otherwise not be loaded at 132 * all. 133 * 134 * @since Twenty Twenty-Two 1.0 135 * 136 * @return void 137 */ 138 function twentytwentytwo_preload_webfonts() { 139 ?> 140 <link rel="preload" href="<?php echo esc_url( get_theme_file_uri( 'assets/fonts/SourceSerif4Variable-Roman.ttf.woff2' ) ); ?>" as="font" type="font/woff2" crossorigin> 141 <?php 142 } 143 144 endif; 145 146 add_action( 'wp_head', 'twentytwentytwo_preload_webfonts' ); 147 122 148 // Add block patterns 123 149 require get_template_directory() . '/inc/block-patterns.php';
Note: See TracChangeset
for help on using the changeset viewer.