- This topic has 13 replies, 2 voices, and was last updated 1 year, 5 months ago by
Ying.
-
AuthorPosts
-
February 9, 2019 at 6:50 am #805899
Jason
Hello,
I am having some trouble with the font weights, hoping you can help. In this reply, you mentioned that all of the variants are loaded by default:
https://generatepress.com/forums/topic/generatepress-adds-all-the-google-font-weights/
However, I am not experiencing this. For example, I would like to use Poppins for my headings and google fonts shows it has variants 100-900. However in customizer, headings, I only have 300, regular, 500, 700 font weights to choose from.
I saw in some forum posts, you suggest altering the PHP to include custom fonts and variations. However, I don’t think this is a good solution. If I were to hand this site off to a client they are going to expect the font weights to function like any other theme without coding in the functions.php or adding custom css.
Can you help me identify how to get all of the variations of all google fonts to load in the customizer? Thank you guys.
February 9, 2019 at 9:25 am #806023Tom
Lead DeveloperLead DeveloperHi Jason,
It’s likely that we just need to update our built-in list to include those new variants.
For now, you will need to add a function to the site. However, this function adds the missing variants to the Customizer option – it doesn’t make it necessary to add custom CSS or do anything different.
add_filter( 'generate_typography_customize_list', function( $fonts ) { $fonts['poppins']['variants'] = array( '100', '200', '300', '400' ); return $fonts; } );
You can adjust the list of variants to whatever you like.
February 12, 2019 at 11:04 am #808601Jason
Thank you for the reply.
While that may help in one instance, font trends are always changing….and so is the need to update fonts. I don’t think adding a function or CSS on a per case basis is going to work.
Is there a way to update the database? Would you suggest I add a font plugin? Help lol
February 12, 2019 at 5:04 pm #808815Tom
Lead DeveloperLead DeveloperThe only way to do what you’re wanting is to have a direct link to the Google Fonts API which updates fonts and variants automatically. Technically, I believe it’s possible. However, it can introduce a lot of issues as well. It’s something I’d like to get figured out.
I’m not sure what you mean about updating the database?
February 12, 2019 at 5:09 pm #808819Jason
I was referencing:
“Itβs likely that we just need to update our built-in list to include those new variants.”
I am not certain what’s involved to update your list/data but if you could do that I would appreciate it. I am running into this issue all over the place. Just created a subheading and font weight missing for that font also!
February 12, 2019 at 5:21 pm #808835Tom
Lead DeveloperLead DeveloperI’ll see if we can get that updated in the next GP Premium update π
February 13, 2019 at 10:37 am #809600Jason
Thanks!
I used the filter above and it worked. However when I tried to do the same for josefin sans font, it didn’t work.
Can you tell me. Is this correct?
add_filter( ‘generate_typography_customize_list’, function( $fonts ) {
$fonts[‘josefin sans’][‘variants’] = array( ‘100’, ‘200’, ‘300’, ‘400’ );return $fonts;
} );February 13, 2019 at 3:37 pm #809783Tom
Lead DeveloperLead DeveloperLooks like you’re just missing the underscore in the name:
add_filter( 'generate_typography_customize_list', function( $fonts ) { $fonts['josefin_sans']['variants'] = array( '100', '200', '300', '400' ); return $fonts; } );
Let me know π
February 13, 2019 at 6:01 pm #809838Jason
Worked perfectly thanks
February 13, 2019 at 6:04 pm #809839Tom
Lead DeveloperLead DeveloperYou’re welcome π
December 18, 2021 at 7:12 am #2052872Jan
Hi Tom,
I’m having the same issue. As of GPP v2.1.1 there is presumably an easier way for adding a font-weight of say 600 to the Font Manager, correct?
Background: I have added Google-fond “Quicksand” to the Font Manager. Whether I select H2 font-weight “bold” or “600” does not make any difference ;-(
I sense that something else is needed in order to get font-weight 600 to take effect. (See screenshot).
Any advice is much appreciated.
Thanks,
JanDecember 18, 2021 at 12:39 pm #2053215Ying
StaffCustomer SupportHi Jan,
Have you assigned the font to H2? https://www.screencast.com/t/kzBhA4xLeZF
And Have you defined the typography in the page editor for this specific H2?
Any chance you can open a new topic and link us to the page?
December 19, 2021 at 3:11 am #2053485Jan
Hi Ying,
Thanks for sharing the screenshot. I forgot to define the typography for H2.
It works fine now.
Best,
JanDecember 20, 2021 at 8:45 am #2054690Ying
StaffCustomer SupportYou are welcome π
-
AuthorPosts
- You must be logged in to reply to this topic.