Archived topic
Custom fonts not working in Generate Block from child-theme?
1 reply · Started by Ashley on July 20, 2021
Hi, I have followed this tutorial on how to add custom fonts
https://docs.generatepress.com/article/adding-local-fonts/
but the fonts aren't loading in Generate Block at all.
here's my css code
/* TT Commons Black Italic */
@font-face {
font-family: 'tt_commonsblack_italic';
src: local(''),
src: url('https://embroidery.com.sg/our-embroidery-method/wp-content/uploads/2021/07/tt_commons_black_italic-webfont.woff2') format('woff2'),
url('https://embroidery.com.sg/our-embroidery-method/wp-content/uploads/2021/07/tt_commons_black_italic-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
and here's my PHP snippet
add_filter( 'generate_typography_default_fonts', function( $fonts ) {
$fonts[] = 'tt_commonsregular';
return $fonts;
} );
hope you can help me with this
thank you in advance
Hi Ashley,
That PHP snippet is for the theme.
Are you trying to add it as an option to GB's typography dropdown? If so, I'm afraid we've yet to implement the filter to be able to do that.
There's no filter to add in fonts to GB's dropdown yet but Tom's been made aware and is looking into it for the next version -
https://generatepress.com/forums/topic/add-local-font-to-generateblock-dropdown/#post-1828027
https://generatepress.com/forums/topic/add-local-font-to-generateblock-dropdown/#post-1830364