Viewing 24 posts - 1 through 24 (of 24 total)
  • Author
    Posts
  • #340564

    Hey there,

    I would like to use the google font Crimson text (Normal 400 & Normal 400 Italic).
    Yesterday I found this advice to add google fonts:
    “Edit functions.php, find this code:

    if(isset($avia_config[‘use_child_theme_functions_only’])) return;

    Below, add this code:

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

    add_filter( ‘avf_google_content_font’, ‘avia_add_content_font’);
    function avia_add_content_font($fonts)
    {
    $fonts[‘Alef’] = ‘Alef’;
    return $fonts;
    }”

    But, in my case, I don’t use a child theme,
    so that I couldn’t find code, that is mentioned in the discription.
    Is there any other way to use this font(s) as my content font for continuous text?

    #340603

    Hi!

    Following line should be in Functions.php file of your parent theme

    if(isset($avia_config['use_child_theme_functions_only'])) return;

    Do you mind creating a temporary admin login and posting it here privately?

    Regards,
    Yigit

    #341558
    This reply has been marked as private.
    #341568

    Hey!

    We need WordPress admin logins

    Best regards,
    Yigit

    #341735
    This reply has been marked as private.
    #342458

    Hey!

    Sorry Danny i wanted to add the code to functions.php file but “Editor” tab under “Appearance” is missing. Have you tried adding the code to bottom of Functions.php file? If not, can you please try to do so

    Regards,
    Yigit

    #342647

    Hey,

    yes I tried to add the code to the bottom of the functions.php, but when I updated my site,
    the hole website didn’t work anymore, so that I had to delete the code quickly. :/

    #343852

    Hey!

    I’m sorry but code is wrong, specifically the single quotations. Please add this below line 16 of functions.php:

    add_filter( 'avf_google_heading_font',  'avia_add_heading_font');
    function avia_add_heading_font($fonts)
    {
    $fonts['Alef'] = 'Alef:400,700';
    return $fonts;
    }
    
    add_filter( 'avf_google_content_font',  'avia_add_content_font');
    function avia_add_content_font($fonts)
    {
    $fonts['Alef'] = 'Alef:400,700';
    return $fonts;
    }

    Cheers!
    Ismael

    #345850

    I tried to add the code, but got the same issue as earlier:

    Parse error: syntax error, unexpected ‘function’ (T_FUNCTION) in /www/htdocs/v084080/coeval/wp-includes/functions.php on line 16″

    Is there a chance, that I send you my functions.php and you add the code at the right position & send the new file back to me?

    #346105

    Hey!

    You can send paste the content of your functions.php file here – http://pastebin.com/ and post the link to us

    Regards,
    Yigit

    #346151
    This reply has been marked as private.
    #346550

    Hey!

    It is not the theme’s functions.php file. Please go to Appearance > Editor then look for Theme Options (functions.php).

    Cheers!
    Ismael

    #349654
    This reply has been marked as private.
    #349680

    Hey!

    Please replace the content of Functions.php file with this one – http://pastebin.com/tQ1nMCUt

    Cheers!
    Yigit

    #349719

    I successfully replaced the code.
    Now the font “Alef” should appear in the Dropdown Menue (Enfold Theme Options > General Styling > Fonts), right?
    ‘Cause in my case, it doesn’t. I reloaded the browser a several times, without any success.

    #349891

    Hi!

    We can do this for you if you enable file editing or provide a temporary FTP account.

    Best regards,
    Josue

    #349989
    This reply has been marked as private.
    #350166

    Hi!

    Alef is now available, as you are not using a child theme i used this plugin to store the custom function separated from the theme files, this way it will survive theme updates.

    Best regards,
    Josue

    #516658

    Hey guys,

    it’s me again. :)

    Today I tried to add a new google font to the wp-content/plugins/functions.php; it’s called Arapey:400italic
    Therefore I downloaded the functions.php, copied the code you created for the Alef Font and changed the fontnames,
    but when I replace my new functions.php on my FTP account I always get “Fatal Errors”, when reload my /wp-admin Site.

    Would you mind to help me out again?

    Best regards,
    Danny

    #516699

    Hi!

    What error do you get exactly? is the FTP account still available?

    Cheers!
    Josue

    #516938

    “Fatal error: Cannot redeclare avia_add_heading_font() (previously declared in /www/htdocs/v084080/coeval/wp-content/plugins/functions.php:16) in /www/htdocs/v084080/coeval/wp-content/plugins/functions.php on line 34”

    Yes, the FTP Account is still available. ;)

    #517832

    Ok check it now, here’s the code i’ve used:

    function avia_add_custom_font($fonts)
    {
    $fonts['Alef'] = 'Alef:400,700';
    $fonts['Arapey'] = 'Arapey:400,700';
    return $fonts;
    }
    
    add_filter( 'avf_google_heading_font',  'avia_add_custom_font');
    add_filter( 'avf_google_content_font',  'avia_add_custom_font');
    

    Regards,
    Josue

    #518165

    Thx Josue, it worked great.

    I think my problem was, that I wrote “italic” instead of “700”.
    But now it’s solved. :)

    #518206

    Hey!

    No, problem was “avia_add_heading_font” function was declared twice in functions.php file. Glad Josue could help! Let us know if you have any other questions or issues :)

    Cheers!
    Yigit

Viewing 24 posts - 1 through 24 (of 24 total)
  • The topic ‘google fonts without child theme’ is closed to new replies.