-
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
Fix for template order logic bug introduced in 10.5 #31478
Conversation
Size Change: 0 B Total Size: 1.31 MB ℹ️ View Unchanged
|
IIRC, However, see my notes in the issue: #31399 (comment) and #31399 (comment) (tl;dr -- we should make sure we understand the problem and all of the relevant parts of the code, and might be able to simplify the logic further to make it easier to reason about). |
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.
Let's actually go with this solution for now -- see #31399 (comment) for the rationale.
Thanks for the fix, @vdwijngaert ✨
Oh, wasn't expecting this to go through, but it's probably for the best. Just did some more tests, and as suspected, this needed some tweaking to account for templates from both parent and child themes. Last commit should do the trick. I'd be happy to help review the refactor and accompanying unit tests, so feel free to ping me then. |
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 seems to fix it in my tests as well. I agree about that addicting unit tests for this seem mandatory as a follow-up.
* Fixes template basename issue * Account for templates of both parent and child themes
WIP PR that fixes #31399.
The original code uses
basename
to determine a template's slug, but that doesn't take a template in a subdirectory into account. For at least the basic cases, it appears to be enough to strip theget_stylesheet_directory()
from the path (and remove the php extension).not sure whether to use
get_template_directory
orget_stylesheet_directory
, or both to make it work for child themes as well, need to test that.