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

Explore programattically merging parent/child theme.json #1

Closed
iandunn opened this issue Aug 12, 2021 · 4 comments
Closed

Explore programattically merging parent/child theme.json #1

iandunn opened this issue Aug 12, 2021 · 4 comments
Assignees
Labels
[Type] Question Needs input from others before actionable

Comments

@iandunn
Copy link
Member

iandunn commented Aug 12, 2021

block-based child themes don't inherit a parent's theme.json, which is one of the barriers to parent/child themes.

Unfortunately class-wp-theme-json-resolver.php doesn't have any filters, but we might be able to use WP_Theme_JSON::merge(), or overwrite some global until official support is implemented.

Alternatively, we could assist with WordPress/gutenberg#27305 if we feel like it'd be worth it to start with a parent/child structure from the beginning.

@iandunn iandunn self-assigned this Aug 12, 2021
@iandunn iandunn added the [Type] Question Needs input from others before actionable label Aug 12, 2021
@iandunn iandunn added this to the Initial Launch milestone Aug 12, 2021
@coreymckrill
Copy link
Contributor

At this point I'm leaning towards not bothering with a parent/child setup and just building the News site as a standalone. Beyond the missing functionality, there are still a lot of unknowns about other site redesigns that make it hard to figure out what should go in a parent vs in the child theme. I think we can revisit this and convert this theme to a child later when we have more information and some of the missing functionality has been added.

@iandunn
Copy link
Member Author

iandunn commented Aug 12, 2021

Yeah, I'm guessing that'll be best, I'd just like to try this out in case it's not as hard as we think.

It also doesn't have to be an either/or thing. if this works, then we could create a parent that basically only contains only contains theme.json, and obviously shared things like header/footer templates. Everything else could still go in the child, and be migrated to the parent later on, when those features are supported (or easily hackable).

Doing it that way might save some time when we migrate, and might remind us to be thoughtful about modularity throughout the process of building the child.

@iandunn
Copy link
Member Author

iandunn commented Aug 13, 2021

I dug a bit here, but it doesn't look like WP_Theme_JSON::merge() is useful, since we don't have access to all the places it gets assigned, in order to overwrite it.

block_editor_settings_all could be used in get_block_editor_settings(), but there aren't any filters/globals for wp_render_layout_support_flag() or wp_enqueue_global_styles.

We could contribute to WordPress/gutenberg#27305, but it's probably better to focus our time here instead 👍🏻

@iandunn
Copy link
Member Author

iandunn commented Sep 22, 2021

WordPress/gutenberg#34354 made it so that theme.json is inherited into child themes, but the values can't be overridden yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Question Needs input from others before actionable
Projects
None yet
Development

No branches or pull requests

2 participants