Archived topic
Add more Google Fonts
13 replies · Started by Anonymous on June 22, 2016
I've been testing new Google fonts lately and noticed some are missing from the list like Roboto Light. Can the list be updated and perhaps have a search function to facilitate finding fonts in the dropdown?
Hi there,
Roboto is in the list - then you can set the font weight to something low to get the light version.
As for searching, once the dropdown is open, if you start typing the font name it should jump to it :)
Thanks Tom, it does jump but only based on the first letter. So if I start typing Droid, it goes to the D fonts and then to the R fonts.
Ah yes, I'll see if there's a script that can allow better searching.
I have noticed some fonts are not included in the drop-down list, such as Heebo, Prompt, Suez One, and probably many others. I understand it might not be useful or efficient to list ALL the available Google Fonts - how can I use one of the fonts that is not listed?
It's probably time to update the list in GP.
You can always set all of the Typography options in the Customizer to "inherit", then include the code Google fonts gives you in the wp_head hook.
Then you just need to add the CSS they provide and you're good to go.
Let me know if you need more info :)
I try to find the place in the code that controls the google fonts available in the elementor font interface, I guess is this:
wp-content/themes/generatepress/inc/add-ons/typography.php
In line: 1155
$content = json_decode([...])
I add another json element to the font list, especifying the font that i need. Then i save the PHP file an rerun the config interface again but nothing happens. I guess i am missing something. Please what am i doing wrong? I want to make a quick fix while any update is available.
Thanks for your help
No need to edit core files. This should help: https://docs.generatepress.com/article/customizing-the-google-font-list/
Thanks Tom, wonderful, you saved me.
Great theme, great resources
Glad I could help :)
Hi Tom, just a question on this.
I have added a custom font before that wasn't on the list and it worked perfectly.
Now I wanted to add another (second) new font but am not sure how to add this onto the existing code in the functions file (I'm guessing I need to extend the array but I am not sure the syntax.
Can you advise? Thanks
Catherine
Hi there,
Tom shows the filter syntax here:
https://generatepress.com/forums/topic/gdpr-and-google-fonts/#post-587549
Thank you David! That's perfect.
You're welcome