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 importing block templates and parts from shared directories #4

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

Comments

@iandunn
Copy link
Member

iandunn commented Aug 12, 2021

If #1 is viable, then the next hurdle would be the ability for the child to import templates from the parent.

If it's not, then the collection of standalone themes will need a way to import templates from a shared library (a horizontal relationship, rather than hierarchical). Something like that will be critical for the maintainability as we create more themes for other parts of w.org.

Related WordPress/gutenberg#33959, WordPress/gutenberg#33957

@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
@iandunn iandunn self-assigned this Aug 13, 2021
@iandunn
Copy link
Member Author

iandunn commented Aug 13, 2021

The theme template parts are included here:

https://github.com/WordPress/gutenberg/blob/4f5360e47c9874e52fd74a6b7693e90e107fa2d2/packages/block-library/src/template-part/index.php#L56

The only way I see to customize that would be to use the stylesheet_directory filter, check the stack trace, and if the called is render_block_core_template_part, then change the location.

We could also automate forking them from another repo, ala wporg-repo-tools/bin/update-configs, but that doesn't seem worth it.

So yeah, lets just do everything in the child for now, and then hopefully #13 will be unblocked by the time we go to build the 2nd theme 🤷🏻

If it's not, then maybe we can help push that forward in G before starting the 2nd repo.

@iandunn iandunn closed this as completed Aug 13, 2021
@iandunn
Copy link
Member Author

iandunn commented Aug 18, 2021

A couple other ideas:

  • have a php file hook into the template rendering process just before fse does, load the html from an arbitrary location, and unhook fse loader? - seems fragile, probably not worth it
  • have the .html file start a <?php block because it'll be processed by php anyway? this doesn't seem to work at first glance, but need to understand why before discounting it.
  • create a "global footer" dynamic block, and include that - this seems possible today, and the most practical option. i'm going to explore that as part of Implement global header/footer design for News site #6 / #7

in the future, WordPress/gutenberg#32939 might make that workaround unnecessary. it also has some related issues linked to it

@iandunn
Copy link
Member Author

iandunn commented Sep 22, 2021

WordPress/gutenberg#34354 made it so parent templates are inherited into child themes

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

1 participant