Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #876554

    Hello guys,

    I’ve already added some google fonts to Enfold list using this code in the functions.php file in a child theme :

    /* Add font*/
    add_filter( 'avf_google_heading_font', 'avia_add_heading_font');
    function avia_add_heading_font($fonts)
    {
    $fonts['Volkhov'] = 'Volkhov:400,700';
    return $fonts;
    }

    Today, I’d like to add Lora Regular Italic font, which is also a google font but not the italic version of Lora which is in Enfold, it’s like a new font. Which “word” should I enter instead of ‘Volkhov’. When I look at Google font website, they only give the method to do through thei api :
    <link href="https://fonts.googleapis.com/css?family=Lora:400i" rel="stylesheet">
    and then :
    font-family: 'Lora', serif;
    which is strange because it’s written Lora.

    I hope you understood my problem. Just ahow to know the name of the font to call it in your code.
    Tx !
    Marine

    #876994

    Hey newki75,

    Please try replacing your code with this:

    /* Add font*/
    add_filter( 'avf_google_heading_font', 'avia_add_heading_font');
    function avia_add_heading_font($fonts)
    {
    $fonts['Volkhov'] = 'Volkhov:400,700';
    $fonts['Lora'] = 'Lora:400,700';
    return $fonts;
    }

    Best regards,
    Rikard

    #877047

    Hello Rikard,

    The code you gave is for Lora Regular no ?
    I’d like to add Lora Regular italic, which is a real font and not a font-style italic of Lora :
    https://fonts.google.com/specimen/Lora

    Do u see ? And my question is what entering in $fonts['Lora'] = 'Lora:400,700';
    Tx !

    #877056

    In fact, I’ve copied header.php in my child theme and added this code just before the </head>
    <link href="https://fonts.googleapis.com/css?family=Lora:400,400i" rel="stylesheet">
    In my css, I have a font-family: ‘Lora’… and a font-style: italic
    and it works,

    Is it the good way a doing?
    Tx

    #877984

    Hi,

    Ah ok, sorry about that. Please try this instead:

    /* Add font*/
    add_filter( 'avf_google_heading_font', 'avia_add_heading_font');
    function avia_add_heading_font($fonts)
    {
    $fonts['Volkhov'] = 'Volkhov:400,700';
    $fonts['Lora'] = 'Lora:400italic,700italic';
    return $fonts;
    }

    You can refer to example in the documentation here: https://kriesi.at/documentation/enfold/register-additional-google-fonts-for-theme-options/, you shouldn’t have to edit anything in your header.php file.

    Best regards,
    Rikard

    #1007374

    How about for something like Montserrat Light Italic? I’m trying to use Montserrat Light for my headings and Montserrat Light Italic for my body font. I have the following code in the child theme. Montserrat 300 shows at the bottom of both font lists in the General Styling options, but I”m not seeing Montserrat:300i in the body font list, and selecting those still just seems to give me Montserrat Regular. Is my code correct? I have this site in Maintenance Mode, so I’ll provide credentials.

    Thanks!
    .
    `<?php

    /* ADD GOOGLE FONT */

    add_filter( ‘avf_google_heading_font’, ‘avia_add_heading_font’);
    function avia_add_heading_font($fonts)
    {
    $fonts[‘Montserrat:300’] = ‘Montserrat:300’;
    return $fonts;
    }

    add_filter( ‘avf_google_content_font’, ‘avia_add_content_font’);
    function avia_add_content_font($fonts)
    {
    $fonts[‘Montserrat:300i’] = ‘Montserrat:300i’;
    return $fonts;
    }

    • This reply was modified 6 years, 1 month ago by Basilis.
    #1007685

    Hi,

    I removed your access – please create your own ticket.

    Best regards,
    Basilis

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