admin管理员组文章数量:1124382
The following theme.json settings work as expected on the front end: var(--wp--preset--font-family--greyclif)
is defined for the "font-family" in the main styles in the body{}
tag, and any block without a specifically defined font family renders as Greyclif.
However, in the block editor, any instance where font family is not explicitly defined renders in the web client's default "sans-serif". There is no universal font-family default defined in the styles. The font is available, and can be manually selected, and it renders correctly if selected. But it does not render by default.
Is there something I'm missing here, or is this just another bug?
"styles": {
"typography": {
"fontFamily": "var(--wp--preset--font-family--greyclif)",
"fontSize": "var(--wp--preset--font-size--sm)",
"lineHeight": "1.375"
}
}
The following theme.json settings work as expected on the front end: var(--wp--preset--font-family--greyclif)
is defined for the "font-family" in the main styles in the body{}
tag, and any block without a specifically defined font family renders as Greyclif.
However, in the block editor, any instance where font family is not explicitly defined renders in the web client's default "sans-serif". There is no universal font-family default defined in the styles. The font is available, and can be manually selected, and it renders correctly if selected. But it does not render by default.
Is there something I'm missing here, or is this just another bug?
"styles": {
"typography": {
"fontFamily": "var(--wp--preset--font-family--greyclif)",
"fontSize": "var(--wp--preset--font-size--sm)",
"lineHeight": "1.375"
}
}
Share
Improve this question
asked Aug 26, 2023 at 19:16
StudioAlStudioAl
4841 gold badge3 silver badges15 bronze badges
4
|
1 Answer
Reset to default 0In my case the theme.json was set up correctly and behaving properly. There was an errant editor stylesheet being loaded that shouldn't have been there adding font-family:sans-serif;
to .editor-styles-wrapper
which was overriding the the "var(--wp--preset--font-family--greyclif)"
declaration.
本文标签: Themejson stylestypographyFontFamily renders as default font in front end but not editor
版权声明:本文标题:Theme.json: styles.typography.FontFamily renders as default font in front end but not editor 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736620376a1945562.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
theme.json
? Note that I don't mean using the variables, but rather declaring that there is a font, that it can be found in a specific file etc and letting WordPress generate the CSS variables and fontface declarations itself, e.g. github.com/WordPress/twentytwentythree/blob/trunk/… is that how you're registering it? Have you confirmed this isn't atheme.json
caching problem? – Tom J Nowell ♦ Commented Aug 26, 2023 at 21:07name
,slug
, andfontFamily
stack). But there's no issue in how the font face is loading or rendering. It renders as it should on both the front and the back end when it's selected, it's just that the back end ignores the styles.typography.FontFamily default when it isn't explicitly selected. – StudioAl Commented Aug 26, 2023 at 21:23theme.json
in its entirety as well as any other font families you've defined? It's very likely that you've ommitted something related but considered unimportant that will highlight a problem or eliminate a large number of questions – Tom J Nowell ♦ Commented Aug 26, 2023 at 21:27