Archived topic
local fonts not showing in editor
5 replies · Started by bjbowen on April 25, 2022
I've read through everything.
Added the fonts.css to the child theme (and the fonts folder) Fonts folder is in the uploads folder. Fonts display correctly on front end and in customizer. They do not display correctly in the editor.
Added this code to functions.php:
/* Add local fonts to the editor */
add_filter( 'generate_editor_styles', function( $editor_styles ) {
$editor_styles[] = '/wp-content/themes/generatepress_child/fonts.css';
return $editor_styles;
} );
Hi there,
I don't think the function is necessary, if the local font installed correctly, it should appear in block editor.
How did you apply the font to the text? Using CSS or within the block editor?
Any chance you can link us to your site and point us to where we should be looking at?
Let me know!
I have the font declared in the Customizer for Headings and body.
I didn't make changes to the font on each page (except maybe color). There may be some specific custom css, but again, not to the font family, just maybe color/font-size.
I got that function from a previous support topic about this issue. If I don't need it, I'll be glad to remove it.
Hi there,
try this:
add_filter( 'generate_editor_styles', function( $editor_styles ) {
$editor_styles[] = 'fonts.css';
return $editor_styles;
} );
this assumes fonts.css is the name of your font style sheet and is in the root of your child theme folder.
You're a freaking rock star! Thanks that worked!
Glad to be of help!