Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#24944 closed enhancement (duplicate)

Include a new `locate_template_override` filter to let plugins duck-punch how templates are included.

Reported by: georgestephanis's profile georgestephanis Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.6
Component: Template Keywords: has-patch commit
Focuses: Cc:


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)

24944.diff (617 bytes) - added by georgestephanis 11 years ago.

Download all attachments as: .zip

Change History (9)

#1 @georgestephanis
11 years ago

Also, it may make it simpler for some future core development around this to happen in a plugin.

#2 @ocean90
11 years ago

  • Keywords close added

Duplicate/Related: #13239, #24814, #12877, #14310, #21062.

#3 @georgestephanis
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:
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.)

Version 1, edited 11 years ago by georgestephanis (previous) (next) (diff)

#4 @toscho
11 years ago

  • Cc info@… added

#5 @georgestephanis
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.

#6 @rmccue
11 years ago

  • Keywords commit added; close removed

+1 for more duck-punching.

#7 @georgestephanis
11 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #13239.

#8 @SergeyBiryukov
11 years ago

  • Version changed from trunk to 3.6
Note: See TracTickets for help on using tickets.