summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'themes/twentyfourteen/functions.php')
-rw-r--r--themes/twentyfourteen/functions.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/themes/twentyfourteen/functions.php b/themes/twentyfourteen/functions.php
index f85ef1ca..74141dc3 100644
--- a/themes/twentyfourteen/functions.php
+++ b/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.