[Resolved] Adding a non-google font

Home Forums Support [Resolved] Adding a non-google font

Home Forums Support Adding a non-google font

Viewing 5 posts - 16 through 20 (of 20 total)
  • Author
    Posts
  • #1329770
    David
    Staff
    Customer Support

    Can you share the PHP snippet you used to add the Fonts to the Customizer ?

    ie. this part of the process:
    https://docs.generatepress.com/article/adding-local-fonts/#adding-it-to-the-customizer

    #1329789
    Bob

    In the Child theme Functions.php

    add_filter( ‘generate_typography_default_fonts’, function( $fonts ) {
    $fonts[] = ‘caviardreams’;
    return $fonts;
    } );

    #1329801
    David
    Staff
    Customer Support

    So font name used here:

    $fonts[] = 'caviardreams';

    Must match the font-family added to your @font-face CSS

    font-family: 'caviar_dreamsregular',

    So replace your function with this:

    add_filter( 'generate_typography_default_fonts', function( $fonts ) {
        $fonts[] = 'caviar_dreamsregular';
        $fonts[] = 'caviar_dreamsitalic';
        $fonts[] = 'caviar_dreamsbold';
        $fonts[] = 'caviar_dreamsbold_italic';
        return $fonts;
    } );

    Then you should see all 4 of your fonts in the customizer…. and selecting them should now work.

    #1329840
    Bob

    Thanks David,

    Funny thing is, I tried that earlier without success. I am guessing there was more than one issue at play.
    Anyway, once again you have nailed it. Now I can finally get some sleep.

    Many thanks

    #1329849
    David
    Staff
    Customer Support

    Glad to hear that. And you’re welcome

Viewing 5 posts - 16 through 20 (of 20 total)
  • You must be logged in to reply to this topic.