Free and Premium WordPress Plugins & Themes Forums WordPress Themes Booklium Dequeue Google fonts and enqueue system fonts
- This topic has 2 replies, 3 voices, and was last updated 2 years, 3 months ago by Alex M.
- AuthorPosts
- August 23, 2020 at 10:54 am #994548C GreenParticipant
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
August 26, 2022 at 1:24 am #1346004Gundula UrayParticipantupvote – 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
PeterAugust 30, 2022 at 6:13 am #1347321Alex MParticipantTo 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.
- Create or upload a child theme.
- In the functions.php file of a child theme add the following code:
function booklium_fonts_url() { return ''; }
- 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:
- Create po/mo files for your language.
- Use plugins like Loco translate.
- Add filter to gettext like in this example. Use booklium text-domain to limit your filter.
To host Google fonts locally:
- Download font files from google fonts.
- Convert to woff format.
- Upload font files to server.
- 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
- AuthorPosts
- You must be logged in to reply to this topic.