- This topic has 13 replies, 3 voices, and was last updated 1 year, 5 months ago by
David.
-
AuthorPosts
-
December 29, 2020 at 7:54 am #1598392
Giordano Berwanger
I would like to add the font “Work Sans” on my server to improve the load times of the site, however after following the entire tutorial of the documentation, with the fonts working perfectly on the site, the fonts in the post editor simply broke.
This is the editor before I add the local sources.
https://i.imgur.com/TJmKWk8.pngAnd so it was after I added it.
https://i.imgur.com/itOe4b3.pngAny ideas on how to solve the problem?
December 29, 2020 at 12:11 pm #1598668Tom
Lead DeveloperLead DeveloperHi there,
The editor needs the
@font-face
CSS that you added to your front-end in order to load the fonts.Did you add the
@font-face
CSS in a child theme style.css file, or via another method?Let us know 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentDecember 29, 2020 at 1:48 pm #1598782Giordano Berwanger
Hi Tom!
I had added the@font-face
CSS in the Custom CSS section in Customizer.
Should I add this CSS only in the styles.css of the child theme or both?Thanks for the help!
December 30, 2020 at 4:00 am #1599253David
StaffCustomer SupportHi there,
you will only add it to the Child Theme styles.css.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/December 30, 2020 at 7:19 am #1599618Giordano Berwanger
Hi there!
I added
@font-face
only in Child Theme styles.css, but it doesn’t seem to be working.This is a print of my styles.css file
https://i.imgur.com/n6tdfkE.pngWhat am i missing?
December 30, 2020 at 10:58 am #1599929Tom
Lead DeveloperLead DeveloperYou now need to load that file in the editor.
For example:
add_action( 'enqueue_block_editor_assets', function() { wp_enqueue_style( 'THE URL TO YOUR CHILD THEME CSS FILE' ); } );
That should then load the fonts in the editor 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentDecember 30, 2020 at 2:03 pm #1600039Giordano Berwanger
Ok, now the fonts in editor works like a charm.
But when i remove the
@font-face
from the customizer, fonts in the website is not loading anymore. How can i import the styles.css from my child theme to work on the website too?Thanks!
December 31, 2020 at 12:35 pm #1601043Tom
Lead DeveloperLead DeveloperThe child theme
style.css
file should load automatically on your frontend.Is it named
style.css
in the root folder of your child theme?Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentDecember 31, 2020 at 12:41 pm #1601050Giordano Berwanger
Yes, thats the file.
But apparently it’s not loading on the frontend, it’s only loading fonts when logged in.
January 1, 2021 at 5:54 am #1601464David
StaffCustomer SupportCan you share a link to the site ?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/January 1, 2021 at 8:13 pm #1602175Giordano Berwanger
Sure!
From what I identified, the problem is in the style.css file, which is loaded only when I am logged in.
January 2, 2021 at 3:54 am #1602393David
StaffCustomer SupportCan you disable your cache plugin ?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/January 5, 2021 at 4:44 am #1606288Giordano Berwanger
I cleared the cache and now it works!
Thanks Tom and David, awesome support!
January 5, 2021 at 7:12 am #1606666David
StaffCustomer SupportGlad to hear that!
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.