-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add defaultFontSizes theme.json (theme.json v3) #58409
Conversation
This pull request changed or added PHP files in previous commits, but none have been detected in the latest commit. Thank you! ❤️ |
37060a7
to
0333ef6
Compare
Size Change: +42 B (0%) Total Size: 1.75 MB
ℹ️ View Unchanged
|
0333ef6
to
0c1707f
Compare
0c1707f
to
561ba46
Compare
Flaky tests detected in ec14150. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/8729353311
|
fc92183
to
30e7c4f
Compare
df86af6
to
661f0c0
Compare
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Dev note for both #58409 and #61842 📝 Theme.json version 3The theme.json version has been incremented in order to update the default behavior for overriding the default Using older theme.json versions will continue to be supported and work the same as they have before. However, upgrading to version 3 is recommended when your minimum WordPress version reaches 6.6 because new development will continue in the newer versions. See the theme.json reference for more info on migration.
|
@ajlende The documentation updates look mostly good but there are some files that were not updated, and broken links. Needs updating:
|
While v2 theme.json files will continue to work on current versions of WordPress, the schema is a tool for theme developers to verify their theme.json with the specified version of WordPress you are developing for. Versions of schemas are handled via URL. For example, the last theme.json v2 schema will be located at I didn't do a great job of explaining this in the original theme.json blog post, but unless you are developing for folks with the Gutenberg plugin active, you don't really want to be using the Technically JSON Schema Draft-04 would be able to support all versions simultaneously, but it would be a nightmare to maintain, would be slower for code editors to check, and it wouldn't flag developers working off trunk of a new version where all new work is happening. |
@carolinan Thanks for catching those documentation issues. I found a bunch more issues as I was fixing those things and added everything in #61221. |
@@ -2244,7 +2249,7 @@ | |||
"version": { | |||
"description": "Version of theme.json to use.", | |||
"type": "integer", | |||
"enum": [ 2 ] | |||
"enum": [ 3 ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or should we increase the default theme's theme.json version to 3?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mentioned the default theme as an example. Not everyone will upgrade versions
immediately, and the older versions still work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default themes, like all other themes, should be using the schema for the oldest version of WordPress that they intend to support so that incompatible styles and settings are properly flagged. If the theme.json version is updated to 3, then the theme will only work with 6.6 and up or with the latest Gutenberg plugin installed.
It's confused often enough that I'm planning on writing a developer.wordpress.org blog post to help explain how JSON schema versioning works and how it's different from the theme.json version.
Use the new `defaultFontSizes` setting. We no longer need the `ThemeJson` class because its only purpose was to remove the Core default font sizes. Fixed in Gutenberg: WordPress/gutenberg#58409
See #6616. See also the original Gutenberg PRs: * WordPress/gutenberg#58409 * WordPress/gutenberg#61328 * WordPress/gutenberg#61842 * WordPress/gutenberg#62199 * WordPress/gutenberg#62252 Fixes #61282. Props ajlende, talldanwp, ramonopoly, ellatrix. git-svn-id: https://develop.svn.wordpress.org/trunk@58328 602fd350-edb4-49c9-b593-d223f7449a82
See WordPress/wordpress-develop#6616. See also the original Gutenberg PRs: * WordPress/gutenberg#58409 * WordPress/gutenberg#61328 * WordPress/gutenberg#61842 * WordPress/gutenberg#62199 * WordPress/gutenberg#62252 Fixes #61282. Props ajlende, talldanwp, ramonopoly, ellatrix. Built from https://develop.svn.wordpress.org/trunk@58328 git-svn-id: http://core.svn.wordpress.org/trunk@57785 1a063a9b-81f0-0310-95a4-ce76da25c4cd
See WordPress/wordpress-develop#6616. See also the original Gutenberg PRs: * WordPress/gutenberg#58409 * WordPress/gutenberg#61328 * WordPress/gutenberg#61842 * WordPress/gutenberg#62199 * WordPress/gutenberg#62252 Fixes #61282. Props ajlende, talldanwp, ramonopoly, ellatrix. Built from https://develop.svn.wordpress.org/trunk@58328 git-svn-id: https://core.svn.wordpress.org/trunk@57785 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Dev Note 📝
See #58409 (comment)
What?
Reimplementation of #56661 with a proper theme.json migration.
Adds a
defaultFontSizes
option to disable showing the default font sizes.When
defaultFontSizes === false
the options are removed from the UI.In theme.json v3, by default
defaultFontSizes
istrue
.In theme.json v2,
defaultFontSizes
isn't a valid key, but is treated asfalse
where it would be used when a theme has font sizes defined for backwards compatibility of generated CSS.Why?
Having an option for
defaultFontSizes
would give themes more control over which options are available. This option brings consistency to font sizes to match colors, gradients, duotone filters, and shadow presets.How?
Goals are to migrate the behavior of the font sizes presets to be like other presets that can be disabled via
default*
settings.Testing Instructions
Screenshots below contain example modified
fontSizes
JSON for TT4 to cover various cases of having font sizes and overriding default ones.For each modified theme.json test that each step works as expected (see screenshots):
"version": 2
. (trunk and this PR should be the same.)"version": 3
. (Don't forget to update the style variations too.)settings.typography.defaultFontSizes
tofalse
.Then test custom origin styles migration.
"version": 2
theme.json with no associatedwp_global_styles
post_type
s in the DB."version": 2
entry in the DB."version": 3
in the DB."defaultFontSizes": false
is not added to the entry in the DB."version": 3
."defaultFontSizes": false
is still not added.Testing Instructions for Keyboard
N/A
Screenshots or screencast
Each set of screenshots shows a different example theme.json modification to TT4.
"defaultFontSizes": true
.)false
: Screenshot with"defaultFontSizes": false
set in v3 theme.json.TT4 Footnote Override
Example JSON
false
TT4 Custom Only
Example JSON
false
TT4 Empty
fontSizes
Example JSON
false
TT4 Undefined
fontSizes
Example JSON
false