- This topic has 32 replies, 4 voices, and was last updated 3 years, 1 month ago by
Tom.
-
AuthorPosts
-
March 11, 2019 at 8:28 am #835699
Simon
Hey Guys,
this should be fairly quick.
I just followed the guide to locally host fonts.
Fonts hosted /uploads/fonts/
I referenced the fonts with the full url: https://www.domain.com/wp-content/uploads/fonts/lato-v14-latin-regular.eot
And I have the settings in typrography -> body set as the uploaded font and its variants e.g. regular, italic, 700, 900Now i am just unsure if there is anything i need to do to force the fonts to load from my local hosted files???
Did i miss something?
Cheers,
SimonGeneratePress 2.2.2GP Premium 1.7.8March 11, 2019 at 8:41 am #835718David
StaffCustomer SupportHi there,
i can see lato 700, 900, italic and regular being called locally. But google fonts is still being used. Make sure that you select your local font in the Customizer as opposed to the one in the Google Font list.
I assume you added the filter to display the fonts in the customizer ( as part of the article instructions states)
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 11, 2019 at 10:20 am #835807Simon
Ahhh!!!
I did have the php installed (set to: Only run in administration area (is that correct?))
But hadn’t selected Lato under the “system fonts”, which i have done now. So i think it should all work not.
Thanks so much for your help David. Much appreciated.
Cheers,
SimonMarch 11, 2019 at 12:56 pm #835949David
StaffCustomer SupportThat’s correct Admin only.
Yep all looking good, no google fonts being loaded.Glad to be of help.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 11, 2019 at 2:22 pm #836011Simon
Thanks very much again David.
March 11, 2019 at 3:50 pm #836065David
StaffCustomer SupportYou’re welcome
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 11, 2019 at 4:56 pm #836094Simon
Ah Sorry David. I just purged all the caches, even disabled WPRocket. Cleared my browser cache and ran it in an incognito window. But I am still seeing the font loading from google…
Any thoughts? is it happening for you?
Cheers,
SimonMarch 12, 2019 at 3:26 am #836351David
StaffCustomer SupportI see a couple of cached google font requests.
Do you have any server caches? CloudFlare?You can forcibly remove them from the theme as well this topic:
https://docs.generatepress.com/article/remove-google-fonts/
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 12, 2019 at 4:30 am #836413Simon
Ah thats perfect. I guess I’ll do that and see what happens. Yeah I have cleared every cache there is multiple times, and they are still showing for me. Not sure how to tell if there cached or not…
Thank you again.
Cheers,
SimonMarch 12, 2019 at 5:43 am #836493David
StaffCustomer SupportIn the browser Developer tools > Network will show you where the request is coming from. If it says Cached then its the browser. If the file name looks like gobbledygook then its a cached file being served.
Hope you figure it out π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 12, 2019 at 12:12 pm #836996Simon
Haha, so thats how you spell gobbledygook π
That is really useful to know regardless, i am sure i will use it countless times in the future.
It seems everything has fixed itself, but it looks like maybe WPRocket is possibly preloading google fonts. I have contacted their support about that.
Cheers,
SimonMarch 12, 2019 at 4:04 pm #837158David
StaffCustomer Supporthaha – such a great word π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 17, 2019 at 6:00 am #841277Simon
Hi Guys,
I returned to double check this, but it does appear to me that Generatepress is still making a call to google fonts. I also noted that in the font “typography” selector, when I refresh the page it goes back to the “Lato” google font instead of the “Lato” system font.
I am fairly convinced it is GP loading the css file because if I change the fonts to being different weight, the css font file it calls also changes.
I am using this code to laod the font:
add_filter( ‘generate_typography_default_fonts’, function( $fonts ) {
$fonts[] = ‘Lato’;return $fonts;
} );Should i maybe be using this code instead?
add_filter( ‘generate_typography_default_fonts’,’tu_add_system_fonts’ );
function tu_add_system_fonts( $fonts ) {
$fonts[] = ‘My Font Name’;
return $fonts;
}I am guessing maybe it has something to do with me trying to add a system font that is also in the google fonts?
I also tried to add these but .i got an error when i tried to load both of them?
add_action( ‘wp_enqueue_scripts’,’tu_remove_google_fonts’, 10 );
function tu_remove_google_fonts() {
wp_dequeue_style( ‘generate-fonts’ );
}
If you wish to remove Google Fonts from the customizer as well, you can use the PHP snippet below:add_action( ‘admin_init’, ‘tu_remove_google_fonts’ );
function tu_remove_google_fonts() {
add_filter( ‘generate_google_fonts_array’, ‘__return_false’ );
}Cheers,
SimonMarch 17, 2019 at 8:33 am #841478Tom
Lead DeveloperLead DeveloperHi there,
Yes, it looks like GeneratePress is calling Google for the Lato font.
Just to confirm, you’ve selected the “Lato” font within the “System fonts” area of your typography dropdowns, correct? Are you sure the Google Font version isn’t selected in any of your other typography dropdowns for another element?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMarch 17, 2019 at 9:18 am #841510Simon
Hey Tom,
Yeah thats correct I have selected the lato font under system fonts, however if i refresh the page, the google font is selected again…
Yeah just double checked, inherit is selected in every other typography field.
-
AuthorPosts
- You must be logged in to reply to this topic.