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

Style variations: Allow child themes to exclude specific parent theme style variations #51277

Open
ndiego opened this issue Jun 6, 2023 · 16 comments
Labels
[Feature] Extensibility The ability to extend blocks or the editing experience [Feature] Theme Style Variations Related to style variations provided by block themes [Focus] Blocks Adoption For issues that directly impact the ability to adopt features of Gutenberg. [Type] Enhancement A suggestion for improvement.

Comments

@ndiego
Copy link
Member

ndiego commented Jun 6, 2023

What problem does this address?

If you create a child of a parent theme like TT3, the child theme will include all of the parent's style variations. For theme developers, this is not always preferred.

This issue was mentioned in #45965 (comment) and is related to #47265. Providing a more robust way for child themes to handle the style variations of a parent theme would greatly improve the experience of building block themes that support these features.

What is your proposed solution?

Provide a method for child themes to exclude a parent's style variations.

@ndiego ndiego added [Type] Enhancement A suggestion for improvement. [Feature] Theme Style Variations Related to style variations provided by block themes labels Jun 6, 2023
@bgardner
Copy link

bgardner commented Jun 6, 2023

I echo this suggestion, given the extensive exploration I am going through as I prepare to ship a theme/system shortly. I would love to leverage this functionality, but I need to make decisions based on what is currently available.

@justintadlock
Copy link
Contributor

One thing that might be helpful here is having an API for registering variations. Currently, there's just a class method, WP_Theme_JSON_Resolver::get_style_variations(), for getting all of the variations under the theme/styles folder.

At the very least, the function could use a filter hook for overwriting the $variations array (which should also have named keys for the variations).

@graylaurenm
Copy link
Contributor

It would also be nice to see this with patterns.

@justintadlock
Copy link
Contributor

It would also be nice to see this with patterns.

@graylaurenm - You can already remove patterns registered by the parent theme. Check out the documentation in the Theme Handbook: https://developer.wordpress.org/themes/features/block-patterns/#unregistering-block-patterns

@graylaurenm
Copy link
Contributor

@justintadlock thank you, I must not have Googled this one. 🤦‍♀️

@JDDevo
Copy link

JDDevo commented Feb 15, 2024

I'd like to add my support to this suggestion, I was kind of surprised that this wasn't already a filter. It's important to anyone who wishes to lock down the a theme in terms of style variations (eg brand colours and fonts), but still allow people the ability to edit templates through the editor otherwise. A child theme currently seems to be my way to deal with some of the issues of controlling block themes, and currently I can remove style variations from the parent by deleting the json files from the theme/styles folder but I suspect they would come back on the next theme update. My only other option currently would be to make my own block theme from scratch, which would then miss out on the team updates that 2023/4 are getting. So yes, would be very nice to at least have something I could put in functions.php to limit this.

@bshuchter
Copy link

+1. Agreed. Using TT4, I can easily add a style variation by including the appropriate json file in my child theme. I can also override a parent style variation by naming the json file the same as one of the defaults (e.g., naming the file mint.json but using a different title and different palette within the json file). But I can't remove any of the parent's style variations.

@bshuchter
Copy link

I'm not sure if this is the appropriate forum for a style variation question, so please forgive me if there's a better place to do that. But I just realized that each style variation in TT4 is also loading its own font sets. Are all 8 font sets loaded into memory, or only those related to the active style variation?

@Simpa77
Copy link

Simpa77 commented Apr 8, 2024

+1

@bgardner
Copy link

Would love to see some movement on this.

@annezazu annezazu added [Feature] Extensibility The ability to extend blocks or the editing experience [Focus] Blocks Adoption For issues that directly impact the ability to adopt features of Gutenberg. labels Jun 21, 2024
@rosa2
Copy link

rosa2 commented Jun 22, 2024

+1
Thanks for such a good work 😸

@lewiselborn
Copy link

I'd also like to see this feature, not just for style variations but pattern variations, too.

@dreamerworks
Copy link

+1

@saschafoerster
Copy link

I renamed the folder "styles" to "styles_OFF" in TT4 and that did at least work as a workaround until the next update.

@jabeztadesse
Copy link

+1 Add it to the next update please ...

@studiobovenkamer
Copy link

Looking forward to this addition! It will greatly enhance flexibility for child themes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Extensibility The ability to extend blocks or the editing experience [Feature] Theme Style Variations Related to style variations provided by block themes [Focus] Blocks Adoption For issues that directly impact the ability to adopt features of Gutenberg. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests