You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/how-to-guides/themes/global-settings-and-styles.md
+1-10
Original file line number
Diff line number
Diff line change
@@ -336,16 +336,7 @@ The following presets can be defined via `theme.json`:
336
336
-`color.palette`:
337
337
- generates 3 classes per preset value: color, background-color, and border-color.
338
338
- generates a single custom property per preset value.
339
-
-`spacing.spacingScale`: used to generate an array of spacing preset sizes for use with padding, margin, and gap settings.
340
-
-`operator`: specifies how to calculate the steps with either `*` for multiplier, or `+` for sum.
341
-
-`increment`: the amount to increment each step by. Core by default uses a 'perfect 5th' multiplier of `1.5`.
342
-
-`steps`: the number of steps to generate in the spacing scale. The default is 7. To prevent the generation of the spacing presets, and to disable the related UI, this can be set to `0`.
343
-
-`mediumStep`: the steps in the scale are generated descending and ascending from a medium step, so this should be the size value of the medium space, without the unit. The default medium step is `1.5rem` so the mediumStep value is `1.5`.
344
-
-`unit`: the unit the scale uses, eg. `px, rem, em, %`. The default is `rem`.
345
-
-`spacing.spacingSizes`: themes can choose to include a static `spacing.spacingSizes` array of spacing preset sizes if they have a sequence of sizes that can't be generated via an increment or multiplier.
346
-
-`name`: a human readable name for the size, eg. `Small, Medium, Large`.
347
-
-`slug`: the machine readable name. In order to provide the best cross site/theme compatibility the slugs should be in the format, "10","20","30","40","50","60", with "50" representing the `Medium` size value.
348
-
-`size`: the size, including the unit, eg. `1.5rem`. It is possible to include fluid values like `clamp(2rem, 10vw, 20rem)`.
339
+
-`spacing.spacingSizes`/`spacing.spacingScale`: generates a single custom property per preset value.
349
340
-`typography.fontSizes`: generates a single class and custom property per preset value.
350
341
-`typography.fontFamilies`: generates a single custom property per preset value.
Copy file name to clipboardexpand all lines: docs/reference-guides/theme-json-reference/theme-json-migrations.md
+21-2
Original file line number
Diff line number
Diff line change
@@ -88,8 +88,27 @@ The new `defaultFontSizes` option gives control over showing default font sizes
88
88
89
89
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`, but differs from the behavior in v2.
90
90
91
-
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 the default ones.
92
-
93
91
To keep behavior similar to v2 with a v3 theme.json:
94
92
* If you do not have any `fontSizes` defined, `defaultFontSizes` can be left out or set to `true`.
95
93
* If you have some `fontSizes` defined, set `defaultFontSizes` to `false`.
94
+
95
+
#### `settings.spacing.defaultSpacingSizes`
96
+
97
+
In theme.json v2, there are two settings that could be used to set theme level spacing sizes: `settings.spacing.spacingSizes` and `settings.spacing.spacingScale`. Setting both `spacingSizes`_and_`spacingScale` would only use the values from `spacingSizes`. And setting either of them would always replace the entire set of default spacing sizes provided by WordPress.
98
+
99
+
The default `spacingSizes` slugs provided by WordPress are: `20`, `30`, `40`, `50`, `60`, `70`, and `80`.
100
+
101
+
The new `defaultSpacingSizes` option gives control over showing default spacing sizes and preventing those defaults from being overridden.
102
+
103
+
- When set to `true` it will show the default spacing sizes and prevent them from being overridden by the theme.
104
+
- When set to `false` it will hide the default spacing sizes and allow the theme to use the default slugs.
105
+
106
+
`defaultSpacingSizes` is `true` by default when switching to v3. This is to be consistent with how other `default*` options work such as `settings.color.defaultPalette`, but differs from the behavior in v2.
107
+
108
+
Additionally, in v3 both `spacingSizes` and `spacingScale` can be set at the same time. Presets defined in `spacingSizes` with slugs matching the generated presets from `spacingSizes` will override the generated ones.
109
+
110
+
To keep behavior similar to v2 with a v3 theme.json:
111
+
* If you do not have any `spacingSizes` presets or `spacingScale` config defined, `defaultSpacingSizes` can be left out or set to `true`.
112
+
* If you disabled default spacing sizes by setting `spacingScale` to `{ "steps": 0 }`, remove the `spacingScale` config and set `defaultSpacingSizes` to `false`.
113
+
* If you defined only one of either `spacingScale` or `spacingSizes` for your presets, set `defaultSpacingSizes` to `false`.
114
+
* If you defined both `spacingScale` and `spacingSizes`, remove the `spacingSizes` config _and_ set `defaultSpacingSizes` to `false`.
Copy file name to clipboardexpand all lines: lib/class-wp-theme-json-gutenberg.php
+168-19
Original file line number
Diff line number
Diff line change
@@ -123,6 +123,7 @@ class WP_Theme_JSON_Gutenberg {
123
123
* @since 6.0.0 Replaced `override` with `prevent_override` and updated the
124
124
* `prevent_override` value for `color.duotone` to use `color.defaultDuotone`.
125
125
* @since 6.2.0 Added 'shadow' presets.
126
+
* @since 6.6.0 Updated the 'prevent_override' value for font size presets to use 'typography.defaultFontSizes' and spacing size presets to use `spacing.defaultSpacingSizes`.
126
127
* @since 6.6.0 Added `aspectRatios`.
127
128
* @var array
128
129
*/
@@ -187,7 +188,7 @@ class WP_Theme_JSON_Gutenberg {
0 commit comments