Google font library in the Theme Customizer?


#1

The way I’m currently building this seems a bit complicated. Can anybody point me in the right direction to a clean/smart way of offering the entire Google font library in the Customizer? And how to properly enqueue the font that is selected?

Thanks!


#2

There’s not a really “good” way in my experience. It’s always kinda clunky and a bit messy applying user selected fonts across a theme.


#3
ThemeBeans said

There’s not a really “good” way in my experience. It’s always kinda clunky and a bit messy applying user selected fonts across a theme.

Which should be the right way then, ThemeBeans ?

In my last theme i included them in Customizer because i thought it was correct

Thank you!


#4

I tend not to offer font selections in themes, typography is a big part of a design so it’s hard to then offer out 500 fonts (plus the speed implications)

Though if a buyer really feels they need to be able to change fonts, this plugin is ace: https://wordpress.org/plugins/easy-google-fonts/


#5

Take a look at how Make by the Theme Foundry does it.

Github - https://github.com/thethemefoundry/make/tree/master/src/inc/customizer

Download - https://wordpress.org/themes/make/

The theme is GPL, so you can reuse the code.


#6
tommusrhodus said

I tend not to offer font selections in themes, typography is a big part of a design so it’s hard to then offer out 500 fonts (plus the speed implications)

Apart from the main reason, if it is good practice or not, to include it in theme options, i solved this with a transient variable, do you think this can influence the loading speed, it refresh the list every week or so, so the theme does not load the font list everytime, ?¿??

Though if a buyer really feels they need to be able to change fonts, this plugin is ace: https://wordpress.org/plugins/easy-google-fonts/

I have tried this kind of plugins, and thanks for the recomendation, they are great, i have always thought, and surely i am wrong, i see now, that this was an important thing in marketing the theme, you know ‘more than 600 google Fonts included…’ and etc, even i have considered a risk to not include them…

Regards!


#7
mimo said

i have always thought, and surely i am wrong, i see now, that this was an important thing in marketing the theme, you know ‘more than 600 google Fonts included…’

This is the thing though, one of the big issues we have on TF is that we’re advertising features that realistically aren’t needed by buyers, does a buyer really need 600 fonts to choose from? I’d say only 1 in 50 purchases ask me about fonts, I point them to the above plugin and then they’re happy.

Is offering 600 fonts to choose from simply more likely to confuse a buyer, or cause further styling issues? I’m sure people will argue for either side.


#8
tommusrhodus said

Is offering 600 fonts to choose from simply more likely to confuse a buyer

Completely agree with you. This is something that should be in theme requirements i think

or cause further styling issues?

For this i included in my last theme(unfortunately not selling well) different controls for top,bottom, left and right padding, line height, font-weight, text-transform of main typography items like post titles, meta, content, single titles, pages titles, main menus…etc

Including the Google fonts gave me more work because i thought that if any buyer decide to change the font, he will need this padding, line height, font-weight and text-transform control, because each typo is different.

Now i have it all done so maybe i will continue including this feature, but you have made me think a lot :slight_smile:

Thank you!


#9

Rely on your own design decisions and offer a few select fonts that fit your theme.

The rest should be left to customizations and plugin territory.