Changeset 38870 for trunk/src/wp-content/themes/twentytwelve/functions.php
- Timestamp:
- 10/23/2016 01:55:49 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentytwelve/functions.php
r38093 r38870 157 157 } 158 158 add_action( 'wp_enqueue_scripts', 'twentytwelve_scripts_styles' ); 159 160 /** 161 * Add preconnect for Google Fonts. 162 * 163 * @since Twenty Twelve 2.2 164 * 165 * @param array $urls URLs to print for resource hints. 166 * @param string $relation_type The relation type the URLs are printed. 167 * @return array URLs to print for resource hints. 168 */ 169 function twentytwelve_resource_hints( $urls, $relation_type ) { 170 if ( wp_style_is( 'twentytwelve-fonts', 'queue' ) && 'preconnect' === $relation_type ) { 171 if ( version_compare( $GLOBALS['wp_version'], '4.7-alpha', '>=' ) ) { 172 $urls[] = array( 173 'href' => 'https://fonts.gstatic.com', 174 'crossorigin', 175 ); 176 } else { 177 $urls[] = 'https://fonts.gstatic.com'; 178 } 179 } 180 181 return $urls; 182 } 183 add_filter( 'wp_resource_hints', 'twentytwelve_resource_hints', 10, 2 ); 159 184 160 185 /**
Note: See TracChangeset
for help on using the changeset viewer.