Skip to content

Commit

Permalink
🔧 migrate global settings to theme.json (#2964)
Browse files Browse the repository at this point in the history
  • Loading branch information
retlehs authored Feb 10, 2022
1 parent 9857121 commit b1d291e
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 56 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ However, the amount of effort needed to maintain and develop new features and pr

Make sure all dependencies have been installed before moving on:

- [WordPress](https://wordpress.org/) >= 5.4
- [WordPress](https://wordpress.org/) >= 5.9
- [PHP](https://secure.php.net/manual/en/install.php) >= 7.4.0 (with [`php-mbstring`](https://secure.php.net/manual/en/book.mbstring.php) enabled)
- [Composer](https://getcomposer.org/download/)
- [Node.js](http://nodejs.org/) >= 16
Expand Down
54 changes: 0 additions & 54 deletions app/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,60 +58,6 @@
'primary_navigation' => __('Primary Navigation', 'sage')
]);

/**
* Register the editor color palette.
* @link https://developer.wordpress.org/block-editor/developers/themes/theme-support/#block-color-palettes
*/
add_theme_support('editor-color-palette', []);

/**
* Register the editor color gradient presets.
* @link https://developer.wordpress.org/block-editor/developers/themes/theme-support/#block-gradient-presets
*/
add_theme_support('editor-gradient-presets', []);

/**
* Register the editor font sizes.
* @link https://developer.wordpress.org/block-editor/developers/themes/theme-support/#block-font-sizes
*/
add_theme_support('editor-font-sizes', []);

/**
* Register relative length units in the editor.
* @link https://developer.wordpress.org/block-editor/developers/themes/theme-support/#support-custom-units
*/
add_theme_support('custom-units');

/**
* Enable support for custom line heights in the editor.
* @link https://developer.wordpress.org/block-editor/developers/themes/theme-support/#supporting-custom-line-heights
*/
add_theme_support('custom-line-height');

/**
* Enable support for custom block spacing control in the editor.
* @link https://developer.wordpress.org/block-editor/developers/themes/theme-support/#spacing-control
*/
add_theme_support('custom-spacing');

/**
* Disable custom colors in the editor.
* @link https://developer.wordpress.org/block-editor/developers/themes/theme-support/#disabling-custom-colors-in-block-color-palettes
*/
add_theme_support('disable-custom-colors');

/**
* Disable custom color gradients in the editor.
* @link https://developer.wordpress.org/block-editor/developers/themes/theme-support/#disabling-custom-gradients
*/
add_theme_support('disable-custom-gradients');

/**
* Disable custom font sizes in the editor.
* @link https://developer.wordpress.org/block-editor/developers/themes/theme-support/#disabling-custom-font-sizes
*/
add_theme_support('disable-custom-font-sizes');

/**
* Disable the default block patterns.
* @link https://developer.wordpress.org/block-editor/developers/themes/theme-support/#disabling-the-default-block-patterns
Expand Down
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ Text Domain: sage
License: MIT License
License URI: https://opensource.org/licenses/MIT
Requires PHP: 7.4
Requires at least: 5.4
Requires at least: 5.9
*/
38 changes: 38 additions & 0 deletions theme.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"$schema": "https://schemas.wp.org/trunk/theme.json",
"version": 2,
"settings": {
"color": {
"palette": [
{
"slug": "primary",
"color": "#525ddc",
"name": "Primary"
}
],
"custom": false,
"customGradient": false
},
"custom": {
"spacing": {},
"typography": {
"font-size": {},
"line-height": {}
}
},
"spacing": {
"padding": true,
"units": [
"px",
"%",
"em",
"rem",
"vw",
"vh"
]
},
"typography": {
"customFontSize": false
}
}
}

0 comments on commit b1d291e

Please sign in to comment.