-
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
Try: extract template metadata from the HTML files directly #38984
Conversation
cc @mcsf @mtias @youknowriad is this worth exploring further? |
@@ -323,7 +323,18 @@ function _get_block_templates_files( $template_type ) { | |||
); | |||
|
|||
if ( 'wp_template_part' === $template_type ) { | |||
$template_files[] = _add_block_template_part_area_info( $new_template_item ); | |||
$default_headers = array( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before looking at implementation, I'd like to confirm direction. This is just a way to make this work for testing.
Yes, I think this is worth exploring in the broad context of clarifying and improving the folder structure and auto-load mechanisms (patterns, templates, styles). |
Spin-off from #36751
The templates & parts of block themes are declared via
.html
files. The metadata for each of those files (translatable title, area, post types, etc) is provided via an external file, thetheme.json
(seecustomTemplates
andtemplateParts
keys). This PR explores pulling metadata directly from the.html
files, spinning off from #36751Each template & part would add a top-level comment such as:
How to test
parts/header.html
file in the theme directory:trunk
, it'd be "header".TODO and related work.
wp-cli
: implement extracting the fields available for translation from the.html
templates.theme.json
mechanism if no metadata was found in the template & part.