-
AuthorPosts
-
November 14, 2017 at 12:58 pm #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 !
MarineNovember 15, 2017 at 9:59 am #876994Hey 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,
RikardNovember 15, 2017 at 11:30 am #877047Hello 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/LoraDo u see ? And my question is what entering in
$fonts['Lora'] = 'Lora:400,700';
Tx !November 15, 2017 at 12:08 pm #877056In 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?
TxNovember 17, 2017 at 9:30 am #877984Hi,
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,
RikardSeptember 8, 2018 at 7:49 am #1007374How 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, 3 months ago by Basilis.
September 9, 2018 at 8:11 pm #1007685Hi,
I removed your access – please create your own ticket.
Best regards,
Basilis -
AuthorPosts
- You must be logged in to reply to this topic.