- This topic has 32 replies, 4 voices, and was last updated 3 years, 1 month ago by
Tom.
-
AuthorPosts
-
March 17, 2019 at 9:56 am #841526
Tom
Lead DeveloperLead DeveloperIn that case, I’m guessing you have some sort of caching going on.
You could try naming the font something else, like “Custom Lato”. You’d need to rename it in the
@font-face
definitions and the custom function adding it to the Customizer.Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMarch 18, 2019 at 5:27 am #842027Simon
Ok, i tried that, i changed it to Lato-Custom. Now it makes a call to google for “Lato-Cutom”?
I also cleared all the caches.March 18, 2019 at 9:23 am #842359Tom
Lead DeveloperLead DeveloperCan you share all of the custom functions related to this that you’re using? Be sure to highlight the code in the editor and click the “code” button.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMarch 18, 2019 at 3:12 pm #842677Simon
Sure thing. If I have understood you correctly, your just referring to the php i have added to the snippet plugin. Its just this, and its set to “Only run in administration area”:
add_filter( 'generate_typography_default_fonts', function( $fonts ) { $fonts[] = 'Lato-Custom'; return $fonts; } );
March 18, 2019 at 5:56 pm #842778Tom
Lead DeveloperLead DeveloperWeird – any chance you can send me temporary admin login details so I can take a closer look?: https://generatepress.com/contact
If so, be sure to mention this topic.
Thanks!
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMarch 19, 2019 at 9:00 am #843498Tom
Lead DeveloperLead DeveloperDefinitely something weird going on here – I assume there’s something cache related that’s broken.
Let’s try adding this function:
add_action( 'wp_enqueue_scripts', function() { wp_dequeue_style( 'generate-fonts' ); }, 100 );
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMarch 19, 2019 at 9:20 am #843538Simon
Ah thats really frustrating, I tried disabling WPRocket, and clearing the WPengine caches too.
It seems the code you gave me is working though. What is it doing?
Any thoughts how i can get to the root cause of the issue?
Cheers,
SimonMarch 19, 2019 at 9:23 am #843542Tom
Lead DeveloperLead DeveloperThe code I just provided tells GeneratePress to not load Google Fonts, no matter what.
By default, if a font is provided in the
generate_typography_default_fonts
filter, it won’t trigger Google Fonts. For some reason, your website is ignoring that logic and trying to call Google anyways.I’ll do some digging to see if there’s a bug somewhere.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMarch 19, 2019 at 11:05 am #843645Simon
Ah gotcha. I think thats a good solution, as is unlikely to cause any issues.
Ah ignoring logic, thats something I am unfortunately very familiar with ๐
Thank you SOOOO much Tom for your ongoing and dedicated support. I really appreciate it.
Regards,
SimonMarch 19, 2019 at 4:49 pm #843921Tom
Lead DeveloperLead DeveloperGlad I could help! ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentFebruary 6, 2020 at 4:31 am #1156435Simon
Hi Tom,
Just a note on this, that it still happening.
I only noticed it on a site I am currently building by chance today and when back to check my other sites. The same issue, GeneratePress was reverting to the Google Font and “not” the local version when I left the Customiser.
Using the following code:
add_action( 'wp_enqueue_scripts', function() { wp_dequeue_style( 'generate-fonts' ); } );
…did not solve the issue. ( I tried both with the priority of 100 and without ).
My site is hosted with SiteGround ( the original person in this thread was hosted with WP Engine ) and I can confirm that even with the SG Optimiser, WP Rocket and Cloudflare disabled nothing worked, except for adding the code above.
I am running my own child theme ( I’m not sure about the person that opened this ticket ) but the only code I use to activate the child theme is:
function generatepress_child_enqueue_scripts() { if ( is_rtl() ) { wp_enqueue_style( 'generatepress-rtl', trailingslashit( get_template_directory_uri() ) . 'rtl.css' ); } } add_action( 'wp_enqueue_scripts', 'generatepress_child_enqueue_scripts', 100 );
The only thing that worked for me was using this code:
add_action( 'wp_enqueue_scripts', function() { wp_dequeue_style( 'generate-fonts' ); } );
Kind regards,
Simon
February 6, 2020 at 8:20 am #1156799Tom
Lead DeveloperLead DeveloperHi Simon,
Can you share the function you’re using to add your custom font to the Customizer?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentFebruary 6, 2020 at 11:11 am #1156964Simon
Hi Tom,
( Just catching on the original author was also called Simon )
I used the code from the Knowledge Base.
Specifically:
add_filter( 'generate_typography_default_fonts', function( $fonts ) { $fonts[] = 'Open Sans'; return $fonts; } );
With the font family changed appropriately. ( Sorry, not at my machine )
Kind regards,
Simon
February 6, 2020 at 5:02 pm #1157210Tom
Lead DeveloperLead DeveloperDid you change the font name at all? I have seen a conflict where the custom font name matches a Google font.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentFebruary 6, 2020 at 8:32 pm #1157314Simon
Hi Tom,
Yup, the font name is changed to a Google Font so that I’m hosting the Google Font locally to improve web performance.
I do this for all my sites. There are only a couple of sites that use Fonts which aren’t actually Google Fonts.
Kind regards,
Simon
-
AuthorPosts
- You must be logged in to reply to this topic.