Site logo

[Resolved] Can’t add custom font

Home Forums Support [Resolved] Can’t add custom font

Home Forums Support Can’t add custom font

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #2416103
    Tan

    I follow this guide. But it doesn’t work. I don’t know what is wrong.

    This is my font link.

    I add font face css below:

    @font-face {
      font-family: 'Boheme Floral';
    	font-weight: normal;
    	font-style: normal;
      src: url('https://nalyn4ever.com/wp-content/uploads/2022/11/Boheme-Floral.ttf') format('truetype');
    }

    Then in Customizer > Typography > Add Font and I paste the name “Boheme Floral” into the Font Family name field, Google Font is disabled.

    But nothing happen when I use Headline block to add this font. (You can see it here)

    I use it in the first sentence of this page (she said yes)

    Please help me fix this.

    Thank you!

    #2416237
    David
    Staff
    Customer Support

    Hi there,

    try converting the font to a .woff and .woff2 versions and load them instead.
    For font conversion, search for Font Squirrel.

    #2416793
    Tan

    Hi David,

    I tried. But it is still not working.

    #2416830
    David
    Staff
    Customer Support

    Can you move your @font-face CSS to the very top of the Additional CSS, so there is no other CSS before it.

    #2416839
    Tan

    Yes, it works! Thank you so much David! 😀

    But it doesn’t show on the backend. What could I do to show it?

    #2416847
    David
    Staff
    Customer Support

    Add this PHP Snippet to your site:

    
    add_filter( 'block_editor_settings_all', function( $editor_settings ) {
        $css = wp_get_custom_css_post()->post_content;
        $editor_settings['styles'][] = array( 'css' => $css );
    
        return $editor_settings;
    } );

    It will load your Customizer Additional CSS in the editor.

    #2416850
    Tan

    Thank you, David. You’re awesome! 😀

    #2416854
    David
    Staff
    Customer Support

    Glad to be of help!

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