Tagged: child theme, functions, google fonts
-
AuthorPosts
-
July 7, 2016 at 2:10 am #657810
So for the most part we can change the entire site to the Roboto font. However when it comes to the body text then there is a lack luster of choices for fonts. Roboto is not among them. We would like to add that font and the option to add Roboto Condensed.
I found some forum posts about it and I tried them but unfortunately any time I try to add the filter to my functions.php it causes a php error and of course the site does not work.
We are not using a child theme because the guy that I am building this site for does not want the child theme. :P
I found this filter:
add_filter( ‘avf_google_heading_font’, ‘avia_add_heading_font’); function avia_add_heading_font($fonts) { $fonts[‘Roboto Condensed’] = ”Roboto Condensed:300,300italic,400,400italic,700,700italic’; return $fonts; } add_filter( ‘avf_google_content_font’, ‘avia_add_content_font’); function avia_add_content_font($fonts) { $fonts[‘Roboto Condensed’] = ‘Roboto Condensed:300,300italic,400,400italic,700,700italic’; return $fonts; }
Suggestions? Ideas? Also if I do want to add Roboto in addition to Roboto Condensed to the body text drop down how would I modify that above code.
Thanks for your time.
July 7, 2016 at 2:45 pm #658084Hi evan_friedl,
Please send us a temporary admin login so that we can have a closer look. You can post the details in the Private Content section of your reply.
Cheers!
RikardJuly 8, 2016 at 9:52 pm #658606Thought I sent this and I may have but my internets been acting up.
July 11, 2016 at 1:55 pm #659259Hi,
I added your code right below following line in functions.php file
if(isset($avia_config['use_child_theme_functions_only'])) return;
Please review your website now
Best regards,
YigitJuly 11, 2016 at 7:18 pm #659497Thank you for your help. So what happens if I want more than one type of Roboto font? For example I want to add Regular Roboto to the content too.
Thanks again for your help
July 11, 2016 at 7:22 pm #659504Hey!
Please see this post – http://kriesi.at/documentation/enfold/register-additional-google-fonts-for-theme-options/
Cheers!
YigitJuly 12, 2016 at 5:57 pm #660003So does that mean its a brand new filter for each font you want to add?
July 12, 2016 at 8:07 pm #660057Hey!
You can edit/add lines in the code you already have
$fonts['PT Sans'] = 'PT Sans:400,700,400italic,700italic';
Best regards,
YigitJuly 12, 2016 at 9:22 pm #660094Yigit before the:
return $fonts;
depending on whether I need it in the heading or content?
Thanks for answering my questions. :)
July 14, 2016 at 3:04 pm #660870Hi,
Yes, it would be as following
add_filter( 'avf_google_heading_font', 'avia_add_heading_font'); function avia_add_heading_font($fonts) { $fonts['PT Sans Narrow'] = 'PT Sans Narrow:400,700'; $fonts['PT Sans'] = 'PT Sans:400,700,400italic,700italic'; $fonts['Raleway'] = 'Raleway:400,700'; return $fonts; } add_filter( 'avf_google_content_font', 'avia_add_content_font'); function avia_add_content_font($fonts) { $fonts['PT Sans'] = 'PT Sans:400,700,400italic,700italic'; $fonts['PT Sans Narrow'] = 'PT Sans Narrow:400,700'; $fonts['Raleway'] = 'Raleway:400,700'; return $fonts; }
Best regards,
Yigit -
AuthorPosts
- You must be logged in to reply to this topic.