Archived topic
Enqueue both google fonts and adobe typekit
3 replies · Started by Heather on November 20, 2019
I am using 3 different fonts that I am currently using a hook to bring the linksheets into the <head>, but I would like to enqueue these in my child theme instead.
I know how to enqueue one google font, but not sure how to enqueue multiple font families in one function. My adobe typekit font is also a .css instead of a .js, so I can't use enqueue scripts.
Is there a function that can enqueue style all three of these? Or do I have to do them separately?
Hi there,
You should be able to do something like this:
add_action( 'wp_enqueue_scripts', function() {
wp_enqueue_script( 'your-font-handle', 'URL TO YOUR SCRIPT' );
wp_enqueue_script( 'another-handle', 'ANOTHER URL HERE' );
wp_enqueue_style( 'one-more', 'URL TO THE CSS FILE' );
} );
Let me know if you need more info :)
So I believe all three are css style linksheets (2 google fonts and 1 adobe typekit), so I would just replace script with style?
Also, I want it to live in my head, so under it would I add add_action wp_head() or something like that?
That's right, you would use wp_enqueue_style in that case. No need to add anything to wp_head() here - you can just add the function I provided above using one of these methods: https://docs.generatepress.com/article/adding-php/