Dequeue Google fonts and enqueue system fonts

Free and Premium WordPress Plugins & Themes Forums WordPress Themes Booklium Dequeue Google fonts and enqueue system fonts

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #994548
    C Green
    Participant

    Hi there

    I’m looking at the option to replace the theme fonts with system fonts to improve performance. I can see in the functions.php file a comment saying: * Create your own booklium_fonts_url() function to override in a child theme.

    Can I just dequeue the google font? And would that automatically cause the theme to load the system fonts? Or do I also need to enqueue the system fonts (or add to my child css file?)

    Thanks in advance

    #1346004
    Gundula Uray
    Participant

    upvote – can we get an answer for this in spite of the recent DSGVO legal problems with Google fonts. Webite owners are getting fined due to google fonts beeing loaded from Google and not locally. I would like to dequeue the google fonts and load them locally from the server. Could you please assist. regards
    Peter

    #1347321
    Alex M
    Participant

    To dequeue Google fonts:

    Option 1. Override the booklium_fonts_url function in your child theme.

    Note that you may lose some configuration like logo and colors so you will need to re-configure these settings in Customizer.

    1. Create or upload a child theme.
    2. In the functions.php file of a child theme add the following code:
      function booklium_fonts_url() {
          return '';
      }
    3. Activate the child theme.

    Option 2. Disable the font with the help of translation.

    Source code from the theme: $font1 = esc_html_x( 'on', 'Montserrat font: on or off', 'booklium' );

    You should translate this to ‘off’. There are several ways:

    1. Create po/mo files for your language.
    2. Use plugins like Loco translate.
    3. Add filter to gettext like in this example. Use booklium text-domain to limit your filter.

    To host Google fonts locally:

    1. Download font files from google fonts.
    2. Convert to woff format.
    3. Upload font files to server.
    4. Add CSS for font-face

    You may find more details in pubic articles. For example https://wplift.com/how-to-host-google-fonts-locally-on-wordpress

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