[wp-trac] [WordPress Trac] #21062: Add a 'template_file' hook to load_template()

WordPress Trac wp-trac at lists.automattic.com
Tue Jul 24 01:54:34 UTC 2012


#21062: Add a 'template_file' hook to load_template()
------------------------------------+------------------------------
 Reporter:  mikeschinkel            |       Owner:
     Type:  enhancement             |      Status:  new
 Priority:  normal                  |   Milestone:  Awaiting Review
Component:  Template                |     Version:  3.4
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |
------------------------------------+------------------------------

Comment (by mikeschinkel):

 Replying to [comment:8 nacin]:
 > I'm weary of adding hooks into`load_template()` and `locate_template()`
 without careful consideration

 Weary?  How can you be tired of adding hooks there, as there are no hooks
 there now!

 Oh, you mean ''"wary"''... ;-)

 But seriously though, `get_included_files()` seems like a good solution,
 except the hook `'debug_bar_panels'` is fired before `/wp-includes
 /template-loader.php` is included, so none of the theme files are
 available then.

 Of course one can call `get_included_files()` and then use `jQuery` to add
 them back into the debug panel but personally I really much prefer to do
 things in PHP whenever possible; it's so much more testable and robust to
 use PHP.

 That said, I'm curious what types of concerns you have able adding this
 hook, and hooks like @sival asks for in '''#18803'''?  Aren't these little
 different than the `'template_include'` hook which lets someone completely
 change the template?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21062#comment:9>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list