-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use the webfont loader with add_editor style? #12
Comments
The Webfont loader and theme.json alone seem to render the google fonts on the Block editor, Site editor, Template editor and front end. I did not have to use functions.php
theme.json
|
The first time I tried it, I thought it worked, but it was only because the font I used was also installed on my system. |
I'm wondering the same thing... not sure how to make the CSS file that gets created in the |
Any news about that? Thanks |
@carolinan ran into the same thing, assumed they were loading in the editor but it was actually locally installed fonts. Here's how I managed to get it working: $url = wptt_get_webfont_url( sprintf(
'https://fonts.googleapis.com/css2?family=%s:wght@%s&display=swap',
$font_family,
$font_weights
) );
add_editor_style( '../../fonts/' . basename( $url ) ); |
To load the font in not only the block editor, but also the template editor and site editor,
Gutenberg asks that theme authors use
add_editor_style
.(Using
enqueue_block_editor_assets
only works for the block editor not the other two)How do we use the webfont loader with the array of styles to load with add_editor_style?
The text was updated successfully, but these errors were encountered: