-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 and border theme_support #47675
Conversation
@@ -323,6 +323,26 @@ public static function get_theme_data( $deprecated = array(), $options = array() | |||
if ( current_theme_supports( 'appearance-tools' ) ) { | |||
$theme_support_data['settings']['appearanceTools'] = true; | |||
} | |||
|
|||
// Allow themes to enable link colors via theme_support. | |||
if ( current_theme_supports( 'link-color' ) ) { |
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 considered "being nice" and include the previous name, experimental-link-color in this condition.
What do you think?
Only one theme in the theme directory uses the appearance-tools theme support. |
An alternative option could be to allow more granular control via the New usage example: add_theme_support( 'appearance-tools', array(
'link-color' => true,
'border' => true,
) ); What do you think? |
We could do that, it would be a smaller code change too. My only remaining concern would be that the theme support would have the same name as the theme.json setting, but not include the same features. This would be confusing. I am not sure documentation would be enough, because there would be an expectation that they match. |
Adding just Using arguments will allow us only to enable specific features. |
I'm not sure about this. I think we should still keep an easy way to opt in to everything by default, otherwise themers are going to have to go and update their themes every time we add a new support. |
What about the appearance tools setting in theme.json? I think a lot of themes use that. |
This seems OK. We could even do a similar thing in theme.json:
|
There seems to be some confusion here still. |
The support was never added to WP 6.1, only Gutenberg. |
Thanks for clearing that up @carolinan |
I was asked to create a new trac ticket for the bug with the appearance tools, and because we have ran out of time for enhancements, the ticket is for reverting without a replacement: |
Thank you, @carolinan! I think reverting the feature makes sense. It was only introduced in 6.2 alpha and isn't working correctly across the board. Let's try and ship a more stable |
@carolinan given the comments above, can this get punted to 6.3 on the project board? |
Yes please |
@scruffian Could you open a separate issue for that? Still seems like a good idea to me. |
Done here: #47925 |
@WordPress/block-themers Would there be more interest in this if I split the border and link control theme support into two PR's? |
Then I will close this PR; You can find the two new PR's linked above. |
What?
Updated February 8 2023.
The PR adds theme supports for link color and borders.
Why?
I have chosen to add all border settings as one theme support. This is different from how the settings in theme.json works.
In theme.json you enable the color, width, style and radius individually, please comment if you feel these should be separate theme supports.
Closes 41857
Alternative to 47451
Related:
core 57460 Backport: appearance-tools theme_support
core 56487 Bundled themes: opt-in to appearance tools
Testing Instructions
In your WordPress install, make sure that WP_DEBUG_DISPLAY, WP_DEBUG are set to true.
Activate Twenty Twenty-One.
You should see a doing it wrong message about
experimental-link-color
.In your code editor, open functions.php in Twenty Twenty-One.
Around line 333, remove
add_theme_support( 'experimental-link-color' );
And add:
On refresh, the doing it wrong notice should no longer show.
Create a new post.
Add a group block with a paragraph inside. Add a link to the paragraph.
Confirm that the paragraph has a link color setting. Select a custom link color and confirm that it works.
(Palette colors will not work on the front, that is a separate issue)
Add a border to the group, test the different border style, width, and color. (select a custom color with the color picker)
and confirm that it works.
There are known bugs in Twenty Twenty-One that needs to be solved, you do not need to test them as part of this PR,
the main goal is to confirm that the controls are available.