- This topic has 5 replies, 2 voices, and was last updated 8 years ago by
Tom.
-
AuthorPosts
-
April 25, 2018 at 10:12 am #560230
Felipe
I am trying to insert a specific font (IBM Plex Serif), but for some reason it is not loaded correctly.
I inserted this action into the child theme’s functions.php, but the variants were not loaded on the front end.
add_filter( 'generate_typography_customize_list', 'tu_add_google_fonts' ); function tu_add_google_fonts( $fonts ) { $fonts[ 'plex_serif' ] = array( 'name' => 'IBM Plex Serif', 'variants' => array( '200', '200i', '300', '300i', '400', '400i', '500', '500i', '600', '600i', '700', '700i' ), 'category' => 'serif' ); return $fonts; }And when you enter the action that supposedly lists the entire library, this font still does not appear.
add_filter( 'generate_number_of_fonts','tu_show_all_available_google_fonts' ); function tu_show_all_available_google_fonts() { return 'all'; }What could be happening?
April 25, 2018 at 9:21 pm #560606Tom
Lead DeveloperLead DeveloperWhen you add this function:
add_filter( 'generate_typography_customize_list', 'tu_add_google_fonts' ); function tu_add_google_fonts( $fonts ) { $fonts[ 'plex_serif' ] = array( 'name' => 'IBM Plex Serif', 'variants' => array( '200', '200i', '300', '300i', '400', '400i', '500', '500i', '600', '600i', '700', '700i' ), 'category' => 'serif' ); return $fonts; }Can you not select the font and variants within the Customizer?
April 26, 2018 at 4:47 am #560865Felipe
I replaced the action that loads the entire library, to the above code.
The font appears in the list, but the variations are not loaded. It is only loaded with normal variation, or 400.

If in font weight I select bold, it is not changed to weight 600, but rather forced bold. The same thing happens with italics. It can be perceived by the letter A. The italic style has another design and not just slope.
April 26, 2018 at 10:01 am #561188Tom
Lead DeveloperLead DeveloperTry this:
add_filter( 'generate_typography_customize_list', 'tu_add_google_fonts' ); function tu_add_google_fonts( $fonts ) { $fonts[ 'ibm_plex_serif' ] = array( 'name' => 'IBM Plex Serif', 'variants' => array( '200', '200i', '300', '300i', '400', '400i', '500', '500i', '600', '600i', '700', '700i' ), 'category' => 'serif' ); return $fonts; }April 26, 2018 at 10:07 am #561191Felipe
Worked perfectly!
Thank you 😀April 26, 2018 at 10:08 am #561192Tom
Lead DeveloperLead DeveloperYou’re welcome 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.
