Archived topic
Custom font don't works
3 replies · Started by iain022 on June 19, 2021
Hi GP team,
I'm trying to add a custom font following your guide but I can't do it. It doesn't appear in your font selector.
Your guide: https://docs.generatepress.com/article/adding-local-fonts/
My style.css code for my child-theme:
@font-face {
font-family: 'Bebas Neue';
font-style: normal;
font-weight: 400;
src: url('https://mynameweb.com/wp-content/uploads/fonts/bebas-neue-v2-latin-regular.eot'); /* IE9 Compat Modes */
src: local(''),
url('https://mynameweb.com/wp-content/uploads/fonts/bebas-neue-v2-latin-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('https://mynameweb.com/wp-content/uploads/fonts/bebas-neue-v2-latin-regular.woff2') format('woff2'), /* Super Modern Browsers */
url('https://mynameweb.com/wp-content/uploads/fonts/bebas-neue-v2-latin-regular.woff') format('woff'), /* Modern Browsers */
url('https://mynameweb.com/wp-content/uploads/fonts/bebas-neue-v2-latin-regular.ttf') format('truetype'), /* Safari, Android, iOS */
url('https://mynameweb.com/wp-content/uploads/fonts/bebas-neue-v2-latin-regular.svg#BebasNeue') format('svg'); /* Legacy iOS */
}
My functions.php code for my child theme:_
add_filter( 'generate_typography_default_fonts', function( $fonts ) {
$fonts[] = 'Bebas Neue';
return $fonts;
} );
Thank you for your nice work
Hi there,
it should appear in the Customizer > Typography at the end of the System Stack fonts - just before the Google Fonts heading with that PHP snippet - can you double check?
Sorry, my mistake was that I had the parent theme activated instead of the child theme.
Thanks for your support
No problem - glad to hear you got it resolved!