[wp-trac] [WordPress Trac] #53744: Cannot set editor font-family via theme.json
WordPress Trac
noreply at wordpress.org
Thu Jul 22 17:53:25 UTC 2021
#53744: Cannot set editor font-family via theme.json
---------------------------+------------------------------
Reporter: TwentyZeroTwo | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version:
Severity: normal | Resolution:
Keywords: close | Focuses:
---------------------------+------------------------------
Changes (by ocean90):
* keywords: => close
Comment:
Hi @TwentyZeroTwo, WordPress 5.8 itself only supports a subset of possible
`theme.json` features. But with the Gutenberg plugin you'll get a few more
features, including support for font-family. On the handbook page for
[https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-
json/#settings settings] and [https://developer.wordpress.org/block-editor
/how-to-guides/themes/theme-json/#styles styles] you can view what is
supported by WordPress and what requires Gutenberg.
Here's a quick example of a `theme.json` (based on
[https://github.com/WordPress/theme-
experiments/blob/master/tt1-blocks/theme.json tt1-blocks]) which would set
a default font-family and one specific to paragraphs - for the editor and
the frontend. But as mentioned above, this requires Gutenberg to be
active.
{{{#!json
{
"version": 1,
"settings": {
"typography": {
"fontFamilies": [
{
"fontFamily": "-apple-system,BlinkMacSystemFont,\"Segoe
UI\",Roboto,Oxygen-Sans,Ubuntu,Cantarell,\"Helvetica Neue\",sans-serif",
"slug": "system-font",
"name": "System Font"
},
{
"fontFamily": "Cambria, Georgia, serif",
"slug": "cambria-georgia"
}
]
}
},
"styles": {
"typography": {
"fontFamily": "var(--wp--preset--font-family--system-font)"
},
"blocks": {
"core/paragraph": {
"typography": {
"fontFamily": "var(--wp--preset--font-family--cambria-georgia)"
}
}
}
}
}
}}}
So right now I'd say that what you want to have is planned for a future
release.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53744#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list