Combine Font API Calls In Child Theme Issu
-
Hi,
I’m running a child theme and I want to combine three of the Google fonts from the parent into one api call. I think I figured out the code for that (below).
I ran it through GTMetrix and it calls it, but it also continues to call them separately. I tried the wp_dequeue_style. It worked on a different font, but not these three.
Plus, not only am I seeing them being called through fonts.googleapis, but again at fonts.gstatic.com in GTMetrix, though not on the page that I see. Why would that be? A plugin calling it? I couldn’t find the gstatic version in the parent’s function.php.
Any ideas would be greatly appreciated. Thanks.
Combining all three:
function prefix_fonts() { wp_enqueue_style( 'prefix_fonts', '//fonts.googleapis.com/css?family=Open+Sans:400,600,700|Lato|Roboto+Slab:400,700', array(), null, 'screen' ); } add_action( 'wp_enqueue_scripts', 'prefix_fonts' );
Code I used to try to dequeue (worked on Droid Arabic Kufi):
‘function remove_default_stylesheet() {
wp_dequeue_style( ‘droidarabickufi’ );
wp_dequeue_style( ‘lato’ );
wp_dequeue_style( ‘roboto-slab’ );
wp_dequeue_style( ‘open-sans’ );
}
add_action( ‘wp_enqueue_scripts’, ‘remove_default_stylesheet’, 11 );’
- The topic ‘Combine Font API Calls In Child Theme Issu’ is closed to new replies.