admin管理员组文章数量:1129123
I have an FSE-related question
- I'm trying to add a font to the 2023 theme but it's not showing in Gutenberg editor.
- In theme.json, in the "settings.typography.fontFamilies" section, I added the following fontFamily definition:
{
"fontFamily": "Sarabun, sans-serif",
"name": "Sarabun",
"slug": "sarabun"
},
I realize that this doesn't import the actual font definition files (...woff2), but I think it should at least show "Sarabun" as an option in gutenberg when I edit a Paragraph block and select the "Typography > Font" dropdown.
Note - this does work when I do these steps on the 2022 theme.
QUESTION - Does anyone know why the font (eg "Sarabun") wouldn't be showing?
I have an FSE-related question
- I'm trying to add a font to the 2023 theme but it's not showing in Gutenberg editor.
- In theme.json, in the "settings.typography.fontFamilies" section, I added the following fontFamily definition:
{
"fontFamily": "Sarabun, sans-serif",
"name": "Sarabun",
"slug": "sarabun"
},
I realize that this doesn't import the actual font definition files (...woff2), but I think it should at least show "Sarabun" as an option in gutenberg when I edit a Paragraph block and select the "Typography > Font" dropdown.
Note - this does work when I do these steps on the 2022 theme.
QUESTION - Does anyone know why the font (eg "Sarabun") wouldn't be showing?
Share Improve this question edited Oct 28, 2023 at 21:51 Tom J Nowell♦ 60.7k7 gold badges77 silver badges147 bronze badges asked Oct 28, 2023 at 21:18 Joshua JJ SJoshua JJ S 315 bronze badges 5 |2 Answers
Reset to default 0@TomJNowell - Thanks for this detail info, clarification and advice. I didn't know about the new debug constant so will learn how to utilize that, and will use a child theme.
I wasn't able to fix this issue, so I spun up a new server and my font updates worked. So I'll just abandon the original server. I'm learning the full site editor and wp theme development so I don't have to keep that old server.
Thanks, Josh
I cannot see my font. but when I rename the folder of Theme TT4, suddenly every font shows up in Gutenberg editor !! what is the reason? and should I rename a folder or make a child theme?
after this, I renamed it back to the original name, but same issue, could not see the font. what is the reason behind it?
本文标签: fontsAdd fontFamily object to themejson
版权声明:本文标题:fonts - Add fontFamily object to theme.json 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736734104a1950155.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
theme.json
gets cached for performance reasons so if you're not telling your WP install it's a dev or local environment it'll assume it's a production env and cachetheme.json
and ignore your changes. Also have you tried declaring the files to use? – Tom J Nowell ♦ Commented Oct 28, 2023 at 21:52theme.json
when you switch.WP_DEBUG
is an ancient debugging constant, but a few major releases ago a new constant was added towp-config.php
that lets you hint to WordPress what kind of environment it's on, e.g. a local env, dev env, staging, production and WordPress will behave slightly differently depending on how it's set. By default it assumes it's a production site. It will even setWP_DEBUG
for you if you say it's a dev environment: developer.wordpress.org/advanced-administration/wordpress/… – Tom J Nowell ♦ Commented Oct 29, 2023 at 14:17theme.json
the files you intend to use. Note though that you should not be modifying 2022 or 2023, you're meant to create child themes so that your changes aren't destroyed when those themes get updated and your modifications remain separate. Last thing you want is to have to redo them all again because you want features and changes in an updated version of the original like form blocks – Tom J Nowell ♦ Commented Oct 29, 2023 at 14:19