Make WordPress Core

Ticket #44668: 44668.0.diff

File 44668.0.diff, 1.0 KB (added by westonruter, 6 years ago)
  • src/wp-content/themes/twentysixteen/functions.php

    diff --git src/wp-content/themes/twentysixteen/functions.php src/wp-content/themes/twentysixteen/functions.php
    index d6e58e1a92..aded1c60e1 100644
    function twentysixteen_content_width() { 
    144144}
    145145add_action( 'after_setup_theme', 'twentysixteen_content_width', 0 );
    146146
     147/**
     148 * Add preconnect for Google Fonts.
     149 *
     150 * @since Twenty Sixteen 1.6
     151 *
     152 * @param array  $urls           URLs to print for resource hints.
     153 * @param string $relation_type  The relation type the URLs are printed.
     154 * @return array $urls           URLs to print for resource hints.
     155 */
     156function twentysixteen_resource_hints( $urls, $relation_type ) {
     157        if ( wp_style_is( 'twentysixteen-fonts', 'queue' ) && 'preconnect' === $relation_type ) {
     158                $urls[] = array(
     159                        'href' => 'https://fonts.gstatic.com',
     160                        'crossorigin',
     161                );
     162        }
     163
     164        return $urls;
     165}
     166add_filter( 'wp_resource_hints', 'twentysixteen_resource_hints', 10, 2 );
     167
    147168/**
    148169 * Registers a widget area.
    149170 *