[Resolved] Adding local fonts broke the fonts of the post editor

Home Forums Support [Resolved] Adding local fonts broke the fonts of the post editor

Home Forums Support Adding local fonts broke the fonts of the post editor

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #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.png

    And so it was after I added it.
    https://i.imgur.com/itOe4b3.png

    Any ideas on how to solve the problem?

    #1598668
    Tom
    Lead Developer
    Lead Developer

    Hi 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 🙂

    #1598782
    Giordano 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!

    #1599253
    David
    Staff
    Customer Support

    Hi there,

    you will only add it to the Child Theme styles.css.

    #1599618
    Giordano 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.png

    What am i missing?

    #1599929
    Tom
    Lead Developer
    Lead Developer

    You 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 🙂

    #1600039
    Giordano 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!

    #1601043
    Tom
    Lead Developer
    Lead Developer

    The child theme style.css file should load automatically on your frontend.

    Is it named style.css in the root folder of your child theme?

    #1601050
    Giordano Berwanger

    Yes, thats the file.

    But apparently it’s not loading on the frontend, it’s only loading fonts when logged in.

    #1601464
    David
    Staff
    Customer Support

    Can you share a link to the site ?

    #1602175
    Giordano Berwanger

    Sure!

    From what I identified, the problem is in the style.css file, which is loaded only when I am logged in.

    #1602393
    David
    Staff
    Customer Support

    Can you disable your cache plugin ?

    #1606288
    Giordano Berwanger

    I cleared the cache and now it works!

    Thanks Tom and David, awesome support!

    #1606666
    David
    Staff
    Customer Support

    Glad to hear that!

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