Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1423387

    Hello,

    How can I add a google font which is not listed? I do not want to upload it on my hosting as it should not be necessary.
    I need to use a google font which is not listed (Assistant), therefore I’ve had to upload it on my hosting, downgrading the speed index.

    is it possible to update the default google font list in theme settings?

    thanks

    #1423508

    Hey edolmen,

    Thank you for the inquiry.

    You can add this code in the functions.php file to register the Assistant font and include it in the font list.

    add_filter( 'avf_google_heading_font', 'avf_google_font_mod');
    add_filter( 'avf_available_google_fonts', 'avf_google_font_mod');
    function avf_google_font_mod($fonts)
    {
        $fonts['Assistant'] = 'Assistant';
        return $fonts;
    }

    Best regards,
    Ismael

    #1423552

    hello, thank you for your answer.
    I see in your code that you declare 2 times the avf_google_font_mod function. Are you sure about that?
    thanks

    #1423555

    i think – yes you can shorten it – and maybe you use the css rule google offers – for those wanted font styles:

    function avia_add_content_font($fonts){
        $fonts['Assistant'] = 'Assistant:wght@300;400;700&display=swap';
        return $fonts;
    }
    add_filter( 'avf_google_heading_font',  'avia_add_content_font');
    add_filter( 'avf_available_google_fonts',  'avia_add_content_font');

    the css definition will be :

    font-family: 'Assistant', sans-serif;
    
    #1423568

    Hi,

    I see in your code that you declare 2 times the avf_google_font_mod function.

    Sorry about that and thank you for noticing. You can remove the duplicate function as @Guenni007 pointed out above.

    Best regards,
    Ismael

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