Tagged: child theme, functions.php, google font
-
AuthorPosts
-
October 24, 2014 at 12:22 pm #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?October 24, 2014 at 2:20 pm #340603Hi!
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,
YigitOctober 27, 2014 at 3:57 pm #341558This reply has been marked as private.October 27, 2014 at 4:16 pm #341568October 27, 2014 at 8:11 pm #341735This reply has been marked as private.October 28, 2014 at 11:31 pm #342458Hey!
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,
YigitOctober 29, 2014 at 11:10 am #342647Hey,
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. :/October 31, 2014 at 4:36 am #343852Hey!
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!
IsmaelNovember 4, 2014 at 2:27 pm #345850I 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?
November 4, 2014 at 8:57 pm #346105Hey!
You can send paste the content of your functions.php file here – http://pastebin.com/ and post the link to us
Regards,
YigitNovember 4, 2014 at 9:56 pm #346151This reply has been marked as private.November 5, 2014 at 3:31 pm #346550Hey!
It is not the theme’s functions.php file. Please go to Appearance > Editor then look for Theme Options (functions.php).
Cheers!
IsmaelNovember 11, 2014 at 8:40 pm #349654This reply has been marked as private.November 11, 2014 at 9:42 pm #349680Hey!
Please replace the content of Functions.php file with this one – http://pastebin.com/tQ1nMCUt
Cheers!
YigitNovember 11, 2014 at 10:44 pm #349719I 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.November 12, 2014 at 6:38 am #349891Hi!
We can do this for you if you enable file editing or provide a temporary FTP account.
Best regards,
JosueNovember 12, 2014 at 1:32 pm #349989This reply has been marked as private.November 12, 2014 at 5:58 pm #350166Hi!
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,
JosueOctober 9, 2015 at 8:18 pm #516658Hey 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,
DannyOctober 9, 2015 at 11:31 pm #516699Hi!
What error do you get exactly? is the FTP account still available?
Cheers!
JosueOctober 11, 2015 at 1:34 pm #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. ;)
October 13, 2015 at 5:37 am #517832Ok 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,
JosueOctober 13, 2015 at 4:20 pm #518165Thx Josue, it worked great.
I think my problem was, that I wrote “italic” instead of “700”.
But now it’s solved. :)October 13, 2015 at 5:17 pm #518206 -
AuthorPosts
- The topic ‘google fonts without child theme’ is closed to new replies.