Make WordPress Core

Opened 13 years ago

Closed 10 years ago

#18803 closed feature request (maybelater)

Core hooks for fragment caching

Reported by: sivel's profile sivel Owned by: sivel's profile sivel
Milestone: Priority: normal
Severity: normal Version: 3.3
Component: Themes Keywords: has-patch dev-feedback
Focuses: template Cc:

Description

I have been running fragment caching for some time, but have seen a few negatives with the way it needs to be implemented currently. With fragment caching potentially becoming even more popular after talks given at WordCamps, core hooks to assist in this are going to become more necessary, for several reasons, such as creating some standardization about how it is integrated into the theme.

Since there are no hooks in something like get_sidebar() -> get_template_part() -> locate_template() -> load_template() you have to create your own function calls to use in a theme to render the sidebar.

In my specific case I was using a child theme, and ended up having to copy over a lot of the parent theme files to make the modification.

My goal is to provide some hooks that would allow use of the standard theme functions such as get_sidebar() but give a plugin or similar access to interrupt the process, generate the cache and output the cache.

My first pass is attached as well as a sample mu-plugin that I have wrote to show how you can use the new hooks to perform fragment caching.

Attachments (4)

18803.diff (892 bytes) - added by sivel 13 years ago.
cache-load-template.php (1.3 KB) - added by sivel 13 years ago.
18803.2.diff (1.0 KB) - added by obenland 10 years ago.
Updated patch
18803.3.diff (2.1 KB) - added by DrewAPicture 10 years ago.
+ hook docs

Download all attachments as: .zip

Change History (19)

@sivel
13 years ago

#1 @freshman66
13 years ago

  • Cc freshman66 added

#2 @sivel
13 years ago

  • Milestone changed from Awaiting Review to 3.4

#3 @tollmanz
13 years ago

  • Cc zack@… added

#4 @kirasong
13 years ago

  • Cc mike.schroder@… added

#5 @ryan
13 years ago

  • Milestone changed from 3.4 to Future Release

Cool, but punting from 3.4 per bug scrub.

#6 @aaroncampbell
13 years ago

  • Cc aaroncampbell added

#7 @mikeschinkel
13 years ago

  • Cc mikeschinkel@… added

#8 @brianlayman
13 years ago

  • Cc Brian@… added

#9 @nacin
11 years ago

  • Component changed from Template to Themes
  • Focuses template added

@obenland
10 years ago

Updated patch

#10 @obenland
10 years ago

Updated the patch. Anyone want to take lead on this?

#11 @DrewAPicture
10 years ago

  • Keywords needs-docs added

Hooks + docs = harmony

#12 @DrewAPicture
10 years ago

  • Keywords needs-docs removed
  • Milestone changed from Future Release to 4.2

18803.3.diff adds docs for the three proposed hooks. Moving to 4.2 for consideration.

@DrewAPicture
10 years ago

+ hook docs

#13 @DrewAPicture
10 years ago

Probably worth considering that the patch introduces a return value for load_template() where there wasn't one before. If we're OK with that, we'll also need to add an @return tag to the DocBlock and (probably) introduce a fallback return value.

This ticket was mentioned in Slack in #core by drew. View the logs.


10 years ago

#15 @DrewAPicture
10 years ago

  • Milestone 4.2 deleted
  • Resolution set to maybelater
  • Status changed from new to closed

The consensus from @nacin is to close this as maybelater since there really isn't anyone to champion this ticket right now.

Note: See TracTickets for help on using tickets.