-
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
Themes: Fix template-hierarchy fallbacks #30599
Conversation
Size Change: 0 B Total Size: 1.42 MB ℹ️ View Unchanged
|
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.
That works for me.
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.
Note that there's another couple of we
s in the original comment.
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.
This makes me wonder whether the logic to get the right template should be "merged" between block templates and php templates.
In other words instead of looping through the templates for php
and then for html
do it once and return the higher priority one starting with html.
Anyway such refactor could be considered separately.
This makes me wonder what the Site Editor is supposed to do when it finds a |
The block template resolution algorithm is quite complex, as it has to cover quite a lot of different possible cases resulting from various combinations of - WP's "old" template hierarchy (including custom page templates, and child themes) - block templates. Things become especially complex when there are e.g. "oldschool" PHP templates with higher specificity than the available block templates; or when a child theme has a PHP template with equal specificity as the parent theme's corresponding block template. For more discussion on this, see #31399. Examples of previous iterations that sought to refine the algorithms' behavior include #29026, #30599, #31123, and #31336. This PR's goal is to eventually cover all of those cases.
Description
Fixes #30565 and bobbingwide/fizzie#58
The problem was that there was no
break
in the loop, so.html
templates with a higher specificity than.php
templates were not properly detected.Checklist:
*.native.js
files for terms that need renaming or removal).