updated theme GeneratePress
version 3.2.0
This commit is contained in:
@ -241,15 +241,33 @@ if ( ! function_exists( 'generate_resource_hints' ) ) {
|
||||
*/
|
||||
function generate_resource_hints( $urls, $relation_type ) {
|
||||
$handle = generate_is_using_dynamic_typography() ? 'generate-google-fonts' : 'generate-fonts';
|
||||
$hint_type = apply_filters( 'generate_google_font_resource_hint_type', 'preconnect' );
|
||||
$has_crossorigin_support = version_compare( $GLOBALS['wp_version'], '4.7-alpha', '>=' );
|
||||
|
||||
if ( wp_style_is( $handle, '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';
|
||||
if ( wp_style_is( $handle, 'queue' ) ) {
|
||||
if ( $relation_type === $hint_type ) {
|
||||
if ( $has_crossorigin_support && 'preconnect' === $hint_type ) {
|
||||
$urls[] = array(
|
||||
'href' => 'https://fonts.gstatic.com',
|
||||
'crossorigin',
|
||||
);
|
||||
|
||||
$urls[] = array(
|
||||
'href' => 'https://fonts.googleapis.com',
|
||||
'crossorigin',
|
||||
);
|
||||
} else {
|
||||
$urls[] = 'https://fonts.gstatic.com';
|
||||
$urls[] = 'https://fonts.googleapis.com';
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'dns-prefetch' !== $hint_type ) {
|
||||
$googleapis_index = array_search( 'fonts.googleapis.com', $urls );
|
||||
|
||||
if ( false !== $googleapis_index ) {
|
||||
unset( $urls[ $googleapis_index ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user