Celebrating 7 Years! Get up to $30 off GeneratePress Premium!

[Support request] Outdated Google Fonts Code?

Home Forums Support [Support request] Outdated Google Fonts Code?

Home Forums Support Outdated Google Fonts Code?

  • This topic has 24 replies, 2 voices, and was last updated 3 years ago by Tom.
Viewing 15 posts - 1 through 15 (of 25 total)
  • Author
    Posts
  • #546145
    Anton

    Hi guys,

    I have an issue with one of my websites running on GP Premium + Elementor pro. When watching the site in the backend of Elementor, I can see all the fonts as they should appear. But on the frontend, it’s all a different font.

    I made a ticket to Elementor, and they say this:

    It is somehow related to their theme that has an outdated google fonts code that may be causing this concern or your hosting provider is blocking google fonts. I would advise you to report this on your hosting provider or your theme provider so you wouldn’t have an issue in the future.

    When reaching out to my hosting provider, they said to add this code to my functions.php:

    function mytheme_enqueue_styles() {
    wp_register_style(‘googleFonts’,’//fonts.googleapis.com/css?family=Copse’);
    wp_enqueue_style( ‘googleFonts’);
    }

    Yet, the issue still isn’t solved. Currently the fonts are barely readable.

    GeneratePress 2.0.2
    #546457
    Tom
    Lead Developer
    Lead Developer

    GP uses that method for all Google fonts by default.

    Your site is currently set to “Poppins”, and the font is displaying nicely for me.

    Are you trying to set a different font?

    I’m not really sure what Elementor support is talking about – there isn’t an outdated way of including Google fonts. They’ve been using the same method for years.

    #546569
    Anton

    Hi Tom,

    Before it was some very light Poppins in italic. I deleted the uploaded font because it was impossible to read.

    Yet, it’s still not ok. This is probably the font you see.
    Knipsel

    But it should be this:
    Knipsel1

    #546935
    Tom
    Lead Developer
    Lead Developer

    It looks like you uploaded your own Poppins font to your server, and are including it with @font-face.

    If you’re doing that, you don’t need to make a call to Google for the fonts.

    Add “Poppins” as a system font using this filter: https://docs.generatepress.com/article/generate_typography_default_fonts/

    Then you’ll be able to choose it from the System Fonts section of the typography dropdown in the Customizer.

    #546952
    Anton

    Hey Tom,

    Yeah, it were the Elementor guys who did that.

    Will follow your instructions when Elementor can’t solve the problem (which still seems to be an SSL issue).

    cheers!
    Anton

    #547164
    Anton

    I got this message from the hosting company:

    I was able to access your dashboard and try to change the fonts from the Elementor builder, however, all fonts resulted in the same error. Then I tried to change your theme to one of the default WordPress ones and was able to modify the font without the bad request errors.

    This indicates that the source of the issue is the current active theme generatepress. We would recommend you to get in touch with their developers and explain the issue. The developers of the theme have more knowldge on the source code of their tool and should be able to advise on a possible solution.

    #547531
    Tom
    Lead Developer
    Lead Developer

    They found that out because then GP isn’t loading Google Fonts. So if you do what I suggested above, the theme won’t load Google Fonts, and your local Poppins file will load.

    #548056
    Anton

    I added this to functions.php:

    add_filter( ‘generate_typography_default_fonts’,’tu_add_system_fonts’ );
    function tu_add_system_fonts( $fonts ) {
    $fonts[] = ‘Poppins’;
    return $fonts;
    }

    I see the font in Customizer, but he can’t find the correct font.

    Do I have to upload the fonts again and if so, in which folder?

    #548585
    Tom
    Lead Developer
    Lead Developer

    Here’s what I’m seeing now: https://www.screencast.com/t/FmBZKyfwVui

    Is that closer to what it should be?

    #548597
    Anton

    For the main text yes, but I used other fonts for the menu, headers, widgets etc.

    #548941
    Tom
    Lead Developer
    Lead Developer

    Hmm ok – let’s step back a bit.

    First, remove the @font-face stuff from your CSS – let’s use the fonts directly from Google.

    Once you do that, choose Poppins from the Google Fonts section in the Customizer.

    If the text is too heavy, you can adjust the font weight and even the variants that come with the font.

    Does that give you a different result at all?

    #551328
    Anton

    Is this a right way to remove font-face?

    kniplse

    #551942
    Tom
    Lead Developer
    Lead Developer

    You should see some blocks similar to that in your custom CSS – you said Elementor support added them? You should just be able to remove the blocks completely, or comment them out as shown in your screenshot.

    #552248
    Anton

    Just found one more block in font awesome essentials.css, nothing to be found in custom css. Just deleted the uploaded fonts now.

    But even then I have the same problem. It’s like the site keeps pointing to the same standard font. System fonts work, but no Google Fonts.

    #552261
    Tom
    Lead Developer
    Lead Developer

    What if you remove the font in your Elementor settings, and choose it in the GP settings? Customize > Typography > Body.

    I’m not sure what Elementor does, but GP allows you to choose which variants and weights to load with the Google Font.

Viewing 15 posts - 1 through 15 (of 25 total)
  • You must be logged in to reply to this topic.