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

Child themes should inherit style variations #45965

Closed
ockham opened this issue Nov 22, 2022 · 13 comments · Fixed by #46554
Closed

Child themes should inherit style variations #45965

ockham opened this issue Nov 22, 2022 · 13 comments · Fixed by #46554
Assignees
Labels
[Feature] Theme Style Variations Related to style variations provided by block themes [Feature] Themes Questions or issues with incorporating or styling blocks in a theme.

Comments

@ockham
Copy link
Contributor

ockham commented Nov 22, 2022

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 a styles/ 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.

@ockham ockham added [Feature] Theme Style Variations Related to style variations provided by block themes [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. labels Nov 22, 2022
@MaggieCabrera
Copy link
Contributor

/cc @WordPress/block-themers for discussion on this issue

@scruffian
Copy link
Contributor

I agree that they should be inherited.

@carolinan
Copy link
Contributor

Same, I did not realize they were not inherited until this morning.

@luminuu
Copy link
Member

luminuu commented Nov 23, 2022

+1 for showing the parent theme style variations in a child theme.

@ockham
Copy link
Contributor Author

ockham commented Nov 24, 2022

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.)

@carolinan
Copy link
Contributor

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.

@MaggieCabrera
Copy link
Contributor

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

@carolinan
Copy link
Contributor

There are already built in ways to remove both of them but sure it can be a follow up :)

@jffng
Copy link
Contributor

jffng commented Dec 16, 2022

I opened a PR above to solve this, let me know what you think! 🙏

@jffng
Copy link
Contributor

jffng commented Jan 18, 2023

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?

@ockham
Copy link
Contributor Author

ockham commented Jan 18, 2023

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?

@ndiego
Copy link
Member

ndiego commented Jan 18, 2023

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.

@jffng
Copy link
Contributor

jffng commented Jan 19, 2023

Do you think that'd be more ergonomic from a theme author's perspective?

I think so, but not sure if it overcomplicates the matter. Opened up a follow up issue to track: #47265

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Theme Style Variations Related to style variations provided by block themes [Feature] Themes Questions or issues with incorporating or styling blocks in a theme.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants