- This topic has 11 replies, 7 voices, and was last updated 5 years, 3 months ago by Leo.
-
AuthorPosts
-
August 26, 2016 at 12:38 am #221415Fernando Díaz Gascón
Hello,
I want to use a Google Font called “Frank Ruhl Libre” and it is not in the Typography add-on list.
Is it planned to be introduced in a next update?
How can I introduce “Frank Ruhl Libre” in my GP web?
I tried to do it following this: https://generatepress.com/forums/topic/add-more-google-fonts/
– I take the codes from Google Fonts.
– I put in wp_head hook this code: <link href=”https://fonts.googleapis.com/css?family=Frank+Ruhl+Libre” rel=”stylesheet”>
– I put in the style.css of my child theme this: font-family: ‘Frank Ruhl Libre’, sans-serif;
– I put “inherit” using the Typography add-on
– It does not workYou can see the result in http://longhu.es.mialias.net/tuina-masaje-chino/ (I changed the body font to inherit).
(the web is in test. To enter:
user: longhu329
pass: 2ZR25mxE
)Thanks in advance
August 26, 2016 at 8:12 am #221474TomLead DeveloperLead DeveloperDid you add the CSS to make your site use the font?
body { font-family: 'Frank Ruhl Libre', sans-serif; }
Let me know 🙂
August 26, 2016 at 11:39 pm #221596Fernando Díaz GascónPerfect!Thanks a lot.
I missed the “body”.
August 27, 2016 at 12:13 am #221605TomLead DeveloperLead DeveloperYou’re welcome 🙂
April 28, 2017 at 4:53 am #311470TalyaHey,
got to this topic as I am searching to use a font that is not in the list – did all the steps but it doesn’t seem to work (tried font Alef – see here: http://www.chubeza.com). tried also to follow this article:
https://docs.generatepress.com/article/customizing-the-google-font-list/
But couldn’t figure out where to add the PHP code – I would rather do that to be able to easily customize each section with my chosen fonts.Sorry for using some else’s topic – hope it’s a common practice, I am new here 🙂
April 28, 2017 at 9:15 am #311580TomLead DeveloperLead DeveloperHi Talya,
The font needs to be a Google Font for now, and you can add the PHP using these instructions: https://docs.generatepress.com/article/adding-php/
A more user friendly interface is something I want to incorporate one day 🙂
May 30, 2017 at 7:31 am #326122RoyIs this possible to add the php code of adding “Alef” google font with GP HOOKS?
I didn’t understand where should I put the code from this guide: https://docs.generatepress.com/article/customizing-the-google-font-list/And I don’t want to install unnecessary plugins..
Thanks,
Roy
May 30, 2017 at 8:58 am #326164LeoStaffCustomer SupportHi Roy,
Try using the Code Snippet plugin: https://docs.generatepress.com/article/adding-php/#code-snippets
It’s a well coded tool that won’t really have any impact on the performance of your site 🙂
March 17, 2018 at 8:54 pm #522751DMI used the code snippet plugin and this code:
add_filter( ‘generate_typography_customize_list’, ‘tu_add_google_fonts’ );
function tu_add_google_fonts( $fonts ) {
$fonts[ ‘nanum_pen_script’ ] = array(
‘name’ => ‘Nanum Pen Script’,
‘variants’ => array( ‘400’, ‘500’, ‘700’ ),
‘category’ => ‘serif’
);return $fonts;
}The font is not in the pull down list under customization-> Typography.
Can you help me?
Thanks!
DMMarch 18, 2018 at 9:39 am #523110LeoStaffCustomer SupportTry this instead:
add_filter( 'generate_typography_customize_list', 'tu_add_google_fonts' ); function tu_add_google_fonts( $fonts ) { $fonts[ 'Nanum_Pen_Script' ] = array( 'name' => 'Nanum Pen Script', 'variants' => array( '400', '500', '700' ), 'category' => 'serif' ); return $fonts; }
December 11, 2018 at 2:42 am #753544benalineThis all worked out perfectly for me using code snippets. I also added extra fonts from the same family using another tip from another thread ( https://generatepress.com/forums/topic/gdpr-and-google-fonts/#post-587549) in one like this, if it might help someone:
add_filter( 'generate_typography_customize_list', 'tu_add_google_fonts' ); function tu_add_google_fonts( $fonts ) { $fonts[ 'Barlow' ] = array( 'name' => 'Barlow', 'variants' => array( '100', '100i', '200', '200i','300', '300i', '400', '400i', '500', '500i', '600', '600i', '700', '700i' ), 'category' => 'sans-serif' ); $fonts[ 'Barlow Condensed' ] = array( 'name' => 'Barlow Condensed', 'variants' => array( '100', '100i', '200', '200i','300', '300i', '400', '400i', '500', '500i', '600', '600i', '700', '700i' ), 'category' => 'sans-serif' ); $fonts[ 'Barlow Semi Condensed' ] = array( 'name' => 'Barlow Semi Condensed', 'variants' => array( '100', '100i', '200', '200i','300', '300i', '400', '400i', '500', '500i', '600', '600i', '700', '700i' ), 'category' => 'sans-serif' ); return $fonts; }
December 11, 2018 at 9:27 am #753942LeoStaffCustomer SupportAwesome 🙂
-
AuthorPosts
- The topic ‘How to add Google font’ is closed to new replies.