Skip to content

Commit 2012a36

Browse files
ajlendeajlendedraganescuscruffiangaambo
authored
Add defaultFontSizes theme.json (v2) (#58409)
Co-authored-by: ajlende <[email protected]> Co-authored-by: draganescu <[email protected]> Co-authored-by: scruffian <[email protected]> Co-authored-by: gaambo <[email protected]> Co-authored-by: youknowriad <[email protected]> Co-authored-by: oandregal <[email protected]>
1 parent 41c80e8 commit 2012a36

37 files changed

+656
-138
lines changed

docs/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@
564564
"parent": "reference-guides"
565565
},
566566
{
567-
"title": "Theme.json Version 2",
567+
"title": "Theme.json Version 3",
568568
"slug": "theme-json-living",
569569
"markdown_source": "../docs/reference-guides/theme-json-reference/theme-json-living.md",
570570
"parent": "theme-json-reference"

docs/reference-guides/theme-json-reference/theme-json-living.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
# Theme.json Version 2
1+
# Theme.json Version 3
22

3-
> This is the living specification for **version 2** of `theme.json`. This version works with WordPress 5.9 or later, and the latest Gutenberg plugin.
3+
> This is the living specification for **version 3** of `theme.json`. This version works with WordPress 5.9 or later, and the latest Gutenberg plugin.
44
>
55
> There are some related documents that you may be interested in:
6-
> - the [theme.json v1](/docs/reference-guides/theme-json-reference/theme-json-v1.md) specification, and
7-
> - the [reference to migrate from theme.json v1 to v2](/docs/reference-guides/theme-json-reference/theme-json-migrations.md).
6+
> - the [theme.json v1](/docs/reference-guides/theme-json-reference/theme-json-v1.md) specification,
7+
> - the [theme.json v2](/docs/reference-guides/theme-json-reference/theme-json-v2.md) specification, and
8+
> - the [reference to migrate from older theme.json versions](/docs/reference-guides/theme-json-reference/theme-json-migrations.md).
89
910
This reference guide lists the settings and style properties defined in the `theme.json` schema. See the [theme.json how to guide](/docs/how-to-guides/themes/global-settings-and-styles.md) for examples and guidance on how to use the `theme.json` file in your theme.
1011

@@ -17,7 +18,7 @@ Code editors can pick up the schema and can provide helpful hints and suggestion
1718
```
1819
{
1920
"$schema": "https://schemas.wp.org/trunk/theme.json",
20-
"version": 2,
21+
"version": 3,
2122
...
2223
}
2324
```
@@ -179,6 +180,7 @@ Settings related to typography.
179180

180181
| Property | Type | Default | Props |
181182
| --- | --- | --- |--- |
183+
| defaultFontSizes | boolean | true | |
182184
| customFontSize | boolean | true | |
183185
| fontStyle | boolean | true | |
184186
| fontWeight | boolean | true | |

docs/reference-guides/theme-json-reference/theme-json-migrations.md

+24
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,27 @@ Additions to styles:
6363
### Changes to property values
6464

6565
The default font sizes provided by core (`settings.typography.fontSizes`) have been updated. The Normal and Huge sizes (with `normal` and `huge` slugs) have been removed from the list, and Extra Large (`x-large` slug) has been added. When the UI controls show the default values provided by core, Normal and Huge will no longer be present. However, their CSS classes and CSS Custom Properties are still enqueued to make sure existing content that uses them still works as expected.
66+
67+
## Migrating from v2 to v3
68+
69+
Upgrading to v3 adjusts preset defaults to be more consistent with one another.
70+
71+
### How to migrate from v1 to v2:
72+
73+
1. Update `version` to `3`.
74+
2. Configure the changed defaults.
75+
76+
### Changed defaults
77+
78+
#### `settings.typography.defaultFontSizes`
79+
80+
In theme.json v2, the default font sizes were only shown when theme sizes were not defined. A theme providing font sizes with the same slugs as the defaults would always override them.
81+
82+
The new `defaultFontSizes` option gives control over showing default font sizes and preventing those defaults from being overridden.
83+
84+
- When set to `true` it will show the default font sizes and prevent them from being overridden by the theme.
85+
- When set to `false` it will hide the default font sizes and allow the theme to use the default slugs.
86+
87+
It is `true` by default when switching to v3. This is to be consistent with how other `default*` options work such as `settings.color.defaultPalette`.
88+
89+
To keep behavior similar to v2, set this value to `false`.

0 commit comments

Comments
 (0)