-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Render wp:template-part in wp:pattern not working #37128
Comments
I am able to reproduce this. I wonder if it is related to #36124 To test, I added this code to functions.php in Twenty Twenty Two:
Note: Template parts are no longer allowed (they can't be placed) inside the post template. |
The template part is missing because the theme attribute is "undefined". |
Perhaps it makes sense to fall back to a template part in the active theme, if no exact match is found? |
I switched to wp:pattern inside wp:pattern until further updates - that works atm. |
@carolinan I can confirm that adding theme attribute ("theme":"wecodeart"), the block renders correctly - but you are right - it makes sense to fallback to the active theme if that is undefined. Note: after #37370 I noticed that the "not found" message does not appear anymore, instead it renders the empty template-part container. |
@ockham might you have any insights here? |
I can have a look, but I'm not too familiar with the code that adds the theme attribute to template parts. AFAIR, @jeyip or @Addison-Stavlo might have more insight into this. |
This seems to make a lot of sense to resolve the current issue, but I believe there were some considerations around theme switches that lead us to introducing the |
But if my existing theme has a template part called "header", and the new theme has a template part called "header", then wouldn't loading that second header template part be the expected result? Not an unwanted side effect. |
It looks like this issue is still present in Version 6.1. While adding attribute |
I'm working on a tutorial for the template-specific patterns and ran into this issue. Now that theme authors can register patterns for template types, this may increasingly become an issue because these types of patterns will often reference header/footer template parts.
This should be the expected behavior. |
Related on that front when handling missing template parts: #49331 |
This issue is similar to #55202 and may have already been resolved in the latest Gutenberg. Is there anyone else who can test it? As shown below, the problem does not seem to occur, at least in TT4.
As you can see, the template parts and patterns are nested in many layers, but they seem to be rendering correctly. |
Am I (still) correct with the assumption that when specifying the |
@strarsis I did not understand the comment or question. |
Description
While testing my custom theme and upcoming wp:pattern block I found that rendering wp:template-part in wp:pattern is not working giving a "Template part has been deleted or is unavailable: entry-meta" error even though the partial exists and it renders using normal query.
Everything is fine with normal query block but not working when calling the same query from a pattern.
See the bellow 4 images, 2 by 2, with working/bugged example.
I believe this is important to be fixed for WP5.9 launch.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
Environment info
Both latest versions.
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: