#27322 closed enhancement (duplicate)
Allow modifying the theme directory stack
Reported by: | rmccue | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Themes | Keywords: | has-patch |
Focuses: | Cc: |
Description
Currently, all internal functions first search the current theme's directory for a file, then the current parent's directory. This step is done manually in things like locate_template
, comments_template
and others.
I'd like to propose adding the ability to override this stack. For plugins that want to add default templates, they can add this to the bottom of the stack and ensure that it works perfectly across the template loader and other functions (such as get_template_part
). It also allows writing plugins to handle more complicated theme hierarchies.
WordPress itself can take advantage of this by adding the theme-compat
directory to the bottom of the stack, allowing fallbacks for things like the comment template/etc without needing the custom code that currently exists.
Note that unlike #13239, this does not allow overriding the template hierarchy, only the theme hierarchy.
Along with this, it makes sense to introduce a theme_url
function along the lines of #18302. I have included that here, since it makes more sense to bundle these changes together, IMO.
Patch attached. No unit tests currently.
Attachments (1)
Change History (8)
This ticket was mentioned in IRC in #wordpress-dev by rmccue. View the logs.
11 years ago
#2
@
11 years ago
(Note that the attached patch only changes locate_template
. There are other occurrences to replace if we want to go all in on the stack.)
#5
@
11 years ago
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from new to closed
Yeah, turns out this is a duplicate of #22355.
#6
@
11 years ago
Dang, knew I saw this somewhere before but couldn't find anything. Transferring patch.
Proof-of-concept patch