#24944 closed enhancement (duplicate)
Include a new `locate_template_override` filter to let plugins duck-punch how templates are included.
Reported by: | georgestephanis | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.6 |
Component: | Template | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
Patch attached.
Basically, the win from this patch is that plugins will be able to swap out how the results of get_template_part() are fetched. If a plugin wants to cache the results of specific template parts, for example, loop.php
or content-reviews.php
-- it can cache those, without forcibly caching content-post.php
or the like.
This should enable much more robust ways of targeted caching.
Attachments (1)
Change History (9)
#3
@
11 years ago
#13239 - unrelated. Deals with a much more limited use case that wouldn't solve for this regardless.
#24814 - unrelated. Deals with a much more complicated fix for a much more unnecessary use case. In comment 10, nacin wrote:
http://core.trac.wordpress.org/ticket/24814#comment:10
You do have one option: To avoid the hierarchy entirely and write your own handling that includes subdirectories. (That's basically what you'd be doing anyway.)
Which this is attempting to address.
#12877 - Again, unrelated. This is not intended to swap out which template file is used (although it could certainly be used as that) -- but rather to enable a modification of how the template is itself pulled in. It can enable a lot of fun and useful customizations, and the citations you're sending back really aren't addressing the issue at hand.
#21062 is the closest, but it's still a different use case. I believe that this could give a tool for folks that need the above as a side benefit, but it keeps things simple -- the same way we did with #15989 with r20694
(so basically, if you're trying to say 'Related' -- kinda, in a vague sense, but definitely -not- Duplicates.)
#5
@
11 years ago
This would also enable performance analytics, such as seeing for slow page loads, which get_template_part() calls happen to suck the most time, and potentially providing a system to toggle caching of them in the Admin UI.
Also, it may make it simpler for some future core development around this to happen in a plugin.