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 theme support option to disable gradient picker #18213

Closed
markhowellsmead opened this issue Oct 31, 2019 · 12 comments
Closed

Add theme support option to disable gradient picker #18213

markhowellsmead opened this issue Oct 31, 2019 · 12 comments
Labels
[Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Type] Enhancement A suggestion for improvement.

Comments

@markhowellsmead
Copy link

In the same way that there is an option add_theme_support('disable-custom-colors');.

@spacedmonkey
Copy link
Member

Related: #18171 #17774

@talldan talldan added [Type] Enhancement A suggestion for improvement. [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. labels Dec 16, 2019
@talldan
Copy link
Contributor

talldan commented Dec 16, 2019

It looks like this was added as an experimental feature only very recently:
5e68cdc#diff-bda1f53deac273d361a56c63a5b90adeR157

@jorgefilipecosta Any further info the reporter should be aware of for this issue?

@jorgefilipecosta
Copy link
Member

Hi @markhowellsmead, as @talldan referred this feature is now available in an experimental state.
It is possible to completely disable gradients using:

add_theme_support( '__experimental-editor-gradient-presets', array() );
add_theme_support( '__experimental-disable-custom-gradients', true );
```.

Thank you for reporting this issue!

@markhowellsmead
Copy link
Author

Great! Thanks @jorgefilipecosta!

@Ahrengot
Copy link

Ahrengot commented Apr 13, 2020

For anyone wondering why the above snippet no longer works. It's been changed to:

add_theme_support('editor-gradient-presets', []);
add_theme_support('disable-custom-gradients', true);

Not sure when that happened, but removing the __experimental- prefix works for me using WordPress 5.4

@jorgefilipecosta
Copy link
Member

Hi @Ahrengot, thank you for sharing the new code, since the original discussion the APIs were stabilized and now the experimental prefix should not be used.

@ooksanen
Copy link

These don't seem to work with the latest plugin. Functions as expected when plugin is disabled.

@EmSixTeen
Copy link

EmSixTeen commented Jun 1, 2022

For anyone wondering why the above snippet no longer works. It's been changed to:

add_theme_support('editor-gradient-presets', []);
add_theme_support('disable-custom-gradients', true);

Not sure when that happened, but removing the __experimental- prefix works for me using WordPress 5.4

Want this too and just tried this, but doesn't seem to be working here - with or without the current Gutenberg (13.3.0) plugin.

A little disconcerting if this isn't just user error on my part but is instead just something else that's now defunct.

@markhowellsmead
Copy link
Author

This option is now best controlled using the theme.json file. https://fullsiteediting.com/lessons/theme-json-color-options/#h-how-to-disable-gradients

@EmSixTeen
Copy link

I don't particularly want to convert my sites to using theme.json just to disable gradients, especially when the option was already previously there.

@markhowellsmead
Copy link
Author

Then I'd suggest opening a new ticket to address the fact that the following theme support definitions don't work for you. (This ticket has been closed since December 2019.)

add_theme_support('editor-gradient-presets', []);
add_theme_support('disable-custom-gradients', true);

@via-lars
Copy link

@EmSixTeen did you open a new ticket? which?

Apart from disbabling gradients not working for me without theme.json I noticed disabled colors are still delivered as CSS variables inline in HTML wp-head global-styles-inline-css

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

8 participants