diff --git a/wp-content/themes/twentyfifteen/functions.php b/wp-content/themes/twentyfifteen/functions.php index 1c382bf138..8ae7e1dacc 100644 --- a/wp-content/themes/twentyfifteen/functions.php +++ b/wp-content/themes/twentyfifteen/functions.php @@ -285,6 +285,31 @@ function twentyfifteen_scripts() { } add_action( 'wp_enqueue_scripts', 'twentyfifteen_scripts' ); +/** + * Add preconnect for Google Fonts. + * + * @since Twenty Fifteen 1.7 + * + * @param array $urls URLs to print for resource hints. + * @param string $relation_type The relation type the URLs are printed. + * @return array URLs to print for resource hints. + */ +function twentyfifteen_resource_hints( $urls, $relation_type ) { + if ( wp_style_is( 'twentyfifteen-fonts', 'queue' ) && 'preconnect' === $relation_type ) { + if ( version_compare( $GLOBALS['wp_version'], '4.7-alpha', '>=' ) ) { + $urls[] = array( + 'href' => 'https://fonts.gstatic.com', + 'crossorigin', + ); + } else { + $urls[] = 'https://fonts.gstatic.com'; + } + } + + return $urls; +} +add_filter( 'wp_resource_hints', 'twentyfifteen_resource_hints', 10, 2 ); + /** * Add featured image as background image to post navigation elements. * diff --git a/wp-content/themes/twentyfourteen/functions.php b/wp-content/themes/twentyfourteen/functions.php index f85ef1ca62..74141dc39c 100644 --- a/wp-content/themes/twentyfourteen/functions.php +++ b/wp-content/themes/twentyfourteen/functions.php @@ -277,6 +277,31 @@ function twentyfourteen_admin_fonts() { } add_action( 'admin_print_scripts-appearance_page_custom-header', 'twentyfourteen_admin_fonts' ); +/** + * Add preconnect for Google Fonts. + * + * @since Twenty Fourteen 1.9 + * + * @param array $urls URLs to print for resource hints. + * @param string $relation_type The relation type the URLs are printed. + * @return array URLs to print for resource hints. + */ +function twentyfourteen_resource_hints( $urls, $relation_type ) { + if ( wp_style_is( 'twentyfourteen-lato', 'queue' ) && 'preconnect' === $relation_type ) { + if ( version_compare( $GLOBALS['wp_version'], '4.7-alpha', '>=' ) ) { + $urls[] = array( + 'href' => 'https://fonts.gstatic.com', + 'crossorigin', + ); + } else { + $urls[] = 'https://fonts.gstatic.com'; + } + } + + return $urls; +} +add_filter( 'wp_resource_hints', 'twentyfourteen_resource_hints', 10, 2 ); + if ( ! function_exists( 'twentyfourteen_the_attached_image' ) ) : /** * Print the attached image with a link to the next attached image. diff --git a/wp-content/themes/twentythirteen/functions.php b/wp-content/themes/twentythirteen/functions.php index ae1bd9e33a..d1f7d5b482 100644 --- a/wp-content/themes/twentythirteen/functions.php +++ b/wp-content/themes/twentythirteen/functions.php @@ -190,6 +190,31 @@ function twentythirteen_scripts_styles() { } add_action( 'wp_enqueue_scripts', 'twentythirteen_scripts_styles' ); +/** + * Add preconnect for Google Fonts. + * + * @since Twenty Thirteen 2.1 + * + * @param array $urls URLs to print for resource hints. + * @param string $relation_type The relation type the URLs are printed. + * @return array URLs to print for resource hints. + */ +function twentythirteen_resource_hints( $urls, $relation_type ) { + if ( wp_style_is( 'twentythirteen-fonts', 'queue' ) && 'preconnect' === $relation_type ) { + if ( version_compare( $GLOBALS['wp_version'], '4.7-alpha', '>=' ) ) { + $urls[] = array( + 'href' => 'https://fonts.gstatic.com', + 'crossorigin', + ); + } else { + $urls[] = 'https://fonts.gstatic.com'; + } + } + + return $urls; +} +add_filter( 'wp_resource_hints', 'twentythirteen_resource_hints', 10, 2 ); + /** * Filter the page title. * diff --git a/wp-content/themes/twentytwelve/functions.php b/wp-content/themes/twentytwelve/functions.php index 56cd8e583b..2dc2cd8bd7 100644 --- a/wp-content/themes/twentytwelve/functions.php +++ b/wp-content/themes/twentytwelve/functions.php @@ -157,6 +157,31 @@ function twentytwelve_scripts_styles() { } add_action( 'wp_enqueue_scripts', 'twentytwelve_scripts_styles' ); +/** + * Add preconnect for Google Fonts. + * + * @since Twenty Twelve 2.2 + * + * @param array $urls URLs to print for resource hints. + * @param string $relation_type The relation type the URLs are printed. + * @return array URLs to print for resource hints. + */ +function twentytwelve_resource_hints( $urls, $relation_type ) { + if ( wp_style_is( 'twentytwelve-fonts', 'queue' ) && 'preconnect' === $relation_type ) { + if ( version_compare( $GLOBALS['wp_version'], '4.7-alpha', '>=' ) ) { + $urls[] = array( + 'href' => 'https://fonts.gstatic.com', + 'crossorigin', + ); + } else { + $urls[] = 'https://fonts.gstatic.com'; + } + } + + return $urls; +} +add_filter( 'wp_resource_hints', 'twentytwelve_resource_hints', 10, 2 ); + /** * Filter TinyMCE CSS path to include Google Fonts. * diff --git a/wp-includes/version.php b/wp-includes/version.php index 314de738c4..6e1030b354 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-alpha-38869'; +$wp_version = '4.7-alpha-38870'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.