-
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
Block Library: Add core template part block. #18736
Conversation
Looks like you still need test fixture files for this block. |
You're right, thanks! I added them. |
Why is there a |
From the PR that introduced it, #18339
|
if ( file_exists( $template_part_file_path ) ) { | ||
$content = file_get_contents( $template_part_file_path ); | ||
} | ||
} |
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.
I'm pretty sure the logic here might need to evolve as we discover edge cases and we polish the flows. I'm not certain the current way of handing theme template parts is the best, but it's a decent one to start with.
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.
We'll need to handle recursive template parts differently, maybe.
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.
LGTM
I managed to make this work (with a rebase) but while testing with https://github.com/carolinan/burgers I noticed this error |
What's in your line 158 after rebasing? It's probably just a missing if-guard. |
Follows #18339
Description
This PR adds the implementation for the
core/template-part
block introduced in #18339.It focuses on the server-side render callback so that block templates that use template parts begin to render correctly on the front end. The editor implementation for creating and editing template parts will come in a follow-up PR.
How has this been tested?
It was verified that the following steps make post previews render as expected:
/block-templates/single.html
:/block-template-parts/header.html
:Types of Changes
New Feature: Added a new server-rendered template part block for the full site editing experiment.
Checklist: