Black Friday Sale! Get up to $40 off GP Premium!Learn more

[Support request] Uploading custom font

Home Forums Support Uploading custom font

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #472493
    Sebastián

    Hi im trying to add a custom font to my website.

    I uploaded all the files through the CPanel and then I put this CSS in the style.css of the theme:

    @font-face {
        font-family: 'geomanistregular';
        src: url('https://sebastiancardozo.com/wp-content/fonts/Geomanist-Regular-Webfont/geomanist-regular-webfont.eot');
        src: url('https://sebastiancardozo.com/wp-content/fonts/Geomanist-Regular-Webfont/geomanist-regular-webfont.eot?#iefix') format('embedded-opentype'),
             url('https://sebastiancardozo.com/wp-content/fonts/Geomanist-Regular-Webfont/geomanist-regular-webfont.woff2') format('woff2'),
             url('https://sebastiancardozo.com/wp-content/fonts/Geomanist-Regular-Webfont/geomanist-regular-webfont.woff') format('woff'),
             url('https://sebastiancardozo.com/wp-content/fonts/Geomanist-Regular-Webfont/geomanist-regular-webfont.ttf') format('truetype'),
             url('https://sebastiancardozo.com/wp-content/fonts/Geomanist-Regular-Webfont/geomanist-regular-webfont.svg#geomanistregular') format('svg');
        font-weight: normal;
        font-style: normal;
    }
    @font-face {
        font-family: 'geomanistitalic';
        src: url('https://sebastiancardozo.com/wp-content/fonts/Geomanist-Regular-Italic-Webfont/geomanist-regular-italic-webfont.eot');
        src: url('https://sebastiancardozo.com/wp-content/fonts/Geomanist-Regular-Italic-Webfont/geomanist-regular-italic-webfont.eot?#iefix') format('embedded-opentype'),
             url('https://sebastiancardozo.com/wp-content/fonts/Geomanist-Regular-Italic-Webfont/geomanist-regular-italic-webfont.woff2') format('woff2'),
             url('https://sebastiancardozo.com/wp-content/fonts/Geomanist-Regular-Italic-Webfont/geomanist-regular-italic-webfont.woff') format('woff'),
             url('https://sebastiancardozo.com/wp-content/fonts/Geomanist-Regular-Italic-Webfont/geomanist-regular-italic-webfont.ttf') format('truetype'),
             url('https://sebastiancardozo.com/wp-content/fonts/Geomanist-Regular-Italic-Webfont/geomanist-regular-italic-webfont.svg#geomanistitalic') format('svg');
        font-weight: normal;
        font-style: normal;
    }

    That’s the CSS for the regular and the italic version of the font.

    Is there something else i need to do? Im not seeing changes.

    Also, I saw another user who asked something similar and you guys told him that he needed to install the code snippets and then put the generate_typography_default_fonts PHP. I tried but it gave me a fatal error.

    Is there something im missing?

    Thanks

    PS: The custom font is geomanist

    GeneratePress 2.0.1
    #472685
    Leo
    Staff
    Customer Support

    Hi there,

    Should be the exact steps here: https://docs.generatepress.com/article/adding-custom-font/

    The filter is just so that it shows up in the customizer.

    What was the code you added?

    #798030
    Jesper

    this link is broken

    https://docs.generatepress.com/article/adding-custom-font/

    how to install custom font?

    #798150
    Leo
    Staff
    Customer Support
    #798432
    Jesper

    Hi
    I cant get it to work…

    Cant select the font in the apperance-themes-typography, and no where on my site is the font used, please help

    this s in my css for the child theme.


    @font-face {
    font-family: ‘No5-Regular’;
    src: url(‘/wp-content/themes/generatepress_child/fonts/No5-Regular.eot’);
    src: url(‘/wp-content/themes/generatepress_child/fonts/No5-Regular.woff2’) format(‘woff2’),
    url(‘/wp-content/themes/generatepress_child/fonts/No5-Regular.woff’) format(‘woff’),
    url(‘/wp-content/themes/generatepress_child/fonts/No5-Regular.ttf’) format(‘truetype’);
    font-weight: normal;
    font-style: normal;
    }

    body, p, span, html, a, div, input, select, option, better, li {
    font-family: ‘No5-Regular’ !important;
    }

    add_filter( ‘generate_typography_default_fonts’, ‘tu_add_local_fonts’ );
    function tu_add_local_fonts( $fonts ) {
    $fonts[] = ‘No5-Regular’;
    return $fonts;
    }

    #798884
    Tom
    Lead Developer
    Lead Developer

    The filter needs to be added using one of these methods: https://docs.generatepress.com/article/adding-php/

    So, remove this from your CSS:

    add_filter( 'generate_typography_default_fonts', 'tu_add_local_fonts' );
    function tu_add_local_fonts( $fonts ) {
        $fonts[] = 'No5-Regular';
        return $fonts;
    }

    And add it using one of the methods in the article above ­čÖé

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