- This topic has 25 replies, 6 voices, and was last updated 5 years, 2 months ago by
Leo.
-
AuthorPosts
-
September 24, 2017 at 12:29 pm #391122
Jacob
This worked perfectly. I used your snippet, Tom, and added the font category and variants.
September 24, 2017 at 6:16 pm #391231Tom
Lead DeveloperLead DeveloperAwesome 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentNovember 5, 2017 at 10:07 pm #416852David R
In the code snippet, adding ksort($fonts); on the line before return $fonts; will keep your fonts list in alphabetical order.
ksort($fonts); return $fonts;
-David R
November 21, 2017 at 9:09 am #429983geco
Hello,
I would like to include more than one source in the theme but I do not understand much about php, this code only has one source and I would like to add two:
$ fonts [‘Revolution_Gothic_p’] = array (
‘name’ => ‘Revolution Gothic p’,
‘variants’ => array (‘300’, ‘300i’, ‘400’, ‘400i’, ‘500’, ‘500i’, ‘600’, ‘600i’, ‘700’, ‘700i’),
‘category’ => ‘serif’Thank you
November 21, 2017 at 7:21 pm #430327Tom
Lead DeveloperLead DeveloperHi there,
Have you tried our custom code here?: https://docs.generatepress.com/article/customizing-the-google-font-list/#adding-your-google-font-to-the-list
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentNovember 22, 2017 at 2:01 am #430461geco
Hello Tom,
Yes, I’ve tried it, in fact it’s the same as the one I sent you.
What I need is to add a second source to that code. How do I include 2 sources in that code?
$ fonts [‘font.1, font.2’] = array (Thank you
SergioNovember 22, 2017 at 8:44 am #430774Tom
Lead DeveloperLead DeveloperAh, like this:
add_filter( 'generate_typography_customize_list', 'tu_add_google_fonts' ); function tu_add_google_fonts( $fonts ) { $fonts[ 'david_libre' ] = array( 'name' => 'David Libre', 'variants' => array( '400', '500', '700' ), 'category' => 'serif' ); $fonts[ 'another_one' ] = array( 'name' => 'Another one', 'variants' => array( '400', '500', '700' ), 'category' => 'serif' ); return $fonts; }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentNovember 23, 2017 at 1:41 am #431330geco
Thanks Tom, this is what I was looking for.
One more thing; I have observed that when accessing in a mobile version the selected sources are not shown and are replaced by others. What is the reason?
November 23, 2017 at 8:05 am #431637Leo
StaffCustomer SupportYour mobile browser might not have that font installed.
I’ve seen it happen a couple times before.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 23, 2017 at 8:10 am #431646geco
solved. It was not displayed because the source was not Google Fonts, I had to host it on my server and it has been fixed.
Thank you
November 23, 2017 at 8:23 am #431666Leo
StaffCustomer SupportNo problem!
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.