twentyfourteen_resource_hints

Add preconnect for Google Fonts.

Description

(array) twentyfourteen_resource_hints( (array) $urls, (string) $relation_type ); 

Returns (array)

URLs to print for resource hints.

Parameters (2)

0. $urls (array)
URLs to print for resource hints.
1. $relation_type (string)
The relation type the URLs are printed.

Usage

  1. if ( !function_exists( 'twentyfourteen_resource_hints' ) ) { 
  2. require_once '/functions.php'; 
  3.  
  4. // URLs to print for resource hints. 
  5. $urls = array(); 
  6.  
  7. // The relation type the URLs are printed. 
  8. $relation_type = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = twentyfourteen_resource_hints($urls, $relation_type); 
  12.  

Defined (1)

The function is defined in the following location(s).

/functions.php  
  1. function twentyfourteen_resource_hints( $urls, $relation_type ) { 
  2. if ( wp_style_is( 'twentyfourteen-lato', 'queue' ) && 'preconnect' === $relation_type ) { 
  3. if ( version_compare( $GLOBALS['wp_version'], '4.7-alpha', '>=' ) ) { 
  4. $urls[] = array( 
  5. 'href' => 'https://fonts.gstatic.com',  
  6. 'crossorigin',  
  7. ); 
  8. } else { 
  9. $urls[] = 'https://fonts.gstatic.com'; 
  10.  
  11. return $urls;