Skip to content
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 link color theme_support #51775

Merged
merged 2 commits into from Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/how-to-guides/themes/theme-json.md
Expand Up @@ -342,8 +342,8 @@ To retain backward compatibility, the existing `add_theme_support` declarations
| `editor-color-palette` | Provide the list of colors via `color.palette`. |
| `editor-font-sizes` | Provide the list of font size via `typography.fontSizes`. |
| `editor-gradient-presets` | Provide the list of gradients via `color.gradients`. |
| `experimental-link-color` | Set `color.link` to `true`. `experimental-link-color` will be removed when the plugin requires WordPress 5.9 as the minimum version. |
| `appearance-tools` | Set `appearanceTools` to `true`. |
| `link-color ` | Set `color.link` to `true`. |

#### Presets

Expand Down
8 changes: 8 additions & 0 deletions docs/how-to-guides/themes/theme-support.md
Expand Up @@ -477,6 +477,14 @@ Use this setting to enable the following Global Styles settings:
add_theme_support( 'appearance-tools' );
```

## Link color

Use this to enable the link color setting:

```php
add_theme_support( 'link-color' );
```

## Block Based Template Parts

Block Based Template parts allow administrators to edit parts of the site using blocks. This is off by default, and requires the theme to opt in by declaring support:
Expand Down
12 changes: 12 additions & 0 deletions lib/class-wp-theme-json-resolver-gutenberg.php
Expand Up @@ -319,6 +319,18 @@ public static function get_theme_data( $deprecated = array(), $options = array()
// Classic themes without a theme.json don't support global duotone.
$theme_support_data['settings']['color']['defaultDuotone'] = false;

// Allow themes to enable link colors via theme_support.
if ( current_theme_supports( 'link-color' ) ) {
$theme_support_data['settings']['color']['link'] = true;
}
if ( current_theme_supports( 'experimental-link-color' ) ) {
_doing_it_wrong(
current_theme_supports( 'experimental-link-color' ),
__( '`experimental-link-color` is no longer supported. Use `link-color` instead.', 'gutenberg' ),
'6.3.0'
);
}

// BEGIN EXPERIMENTAL.
// Allow themes to enable appearance tools via theme_support.
// This feature was backported for WordPress 6.2 as of https://core.trac.wordpress.org/ticket/56487
Expand Down
4 changes: 4 additions & 0 deletions packages/core-data/src/entity-types/theme.ts
Expand Up @@ -141,6 +141,10 @@ declare module './base-entity-records' {
* Post formats supported.
*/
formats: PostFormat[];
/**
* Whether link colors are enabled.
*/
'link-color': boolean;
/**
* The post types that support thumbnails or true if all post types are supported.
*/
Expand Down