-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Child themes should inherit style variations #45965
Comments
/cc @WordPress/block-themers for discussion on this issue |
I agree that they should be inherited. |
Same, I did not realize they were not inherited until this morning. |
+1 for showing the parent theme style variations in a child theme. |
Thanks all! Seems like there's unanimous agreement on the desired behaviour 🎉 Anyone got some spare cycles to implement this? 😬 (My team's focus will be different in the near future.) |
Should the child theme also be able to set variations to "false" ? I mean I think there are use cases where you may want 3 out of 10 variations. |
could be interesting to explore as a follow up, but we don't do that for things like templates or template parts or even patterns |
There are already built in ways to remove both of them but sure it can be a follow up :) |
I opened a PR above to solve this, let me know what you think! 🙏 |
In the case that a child variation overrides the parent, would it be preferred for the styles to actually be merged? That is, the child still overwrites the parent variation, but also inherits styles from the parent variation of the same name? |
Good question 🤔 Do you think that'd be more ergonomic from a theme author's perspective? |
This would allow you to create a child theme that simply tweaks one of the style variations. Not sure how challenging this would be to support, but it would be a good enhancement. |
I think so, but not sure if it overcomplicates the matter. Opened up a follow up issue to track: #47265 |
What problem does this address?
When creating a child theme for an existing block theme that has style variations (such as Twenty Twenty Three), the child theme will currently not include those style variations. If the child theme author wishes to have them included, they will have to manually copy the parent theme's
styles/
folder.First reported in WP.org support forums here.
What is your proposed solution?
Per discussion with @MaggieCabrera: Have child themes include the parent theme's style variations automatically, plus any style variations that the child adds. (If there are any naming collisions, the child's style variation should probably override the parent's style variation with the same name.)
Rationale: I feel that this would be consistent with the way child themes of block themes handle templates. Furthermore, we might want to retain the possibility to create a child theme that only consists of a
style.css
file (and still inherit all the parent's functionality), as is possible with classic themes.We might want to take stock of any other features of block themes that might also not currently be automatically inherited by their child themes.
Note that there is a learn.wordpress.org resource on that subject, and while it mentions that a Block Theme’s child theme should include a
theme.json
, there’s no mention of requiring astyles/
folder to include Style Variations. For now, I'll ask to update that resource to include instructions how to add the parent's style variations.The text was updated successfully, but these errors were encountered: