[wp-trac] [WordPress Trac] #11242: Add "template_include" action to be run just before templates are included

WordPress Trac wp-trac at lists.automattic.com
Wed Nov 25 20:23:58 UTC 2009


#11242: Add "template_include" action to be run just before templates are included
------------------------------------+---------------------------------------
 Reporter:  holizz                  |        Owner:  westi         
     Type:  enhancement             |       Status:  reopened      
 Priority:  normal                  |    Milestone:  Future Release
Component:  Plugins                 |      Version:  2.9           
 Severity:  normal                  |   Resolution:                
 Keywords:  has-patch dev-feedback  |  
------------------------------------+---------------------------------------

Comment(by nacin):

 In that case, let's see if we can get this patch solid.

 What I notice:
  - The return; should be left in for is_robots and is_feed. If you need to
 intercept those, you should use template_redirect.
  - The end of template-loader.php should probably just be:
 {{{
 if ( $template = apply_filters( 'template_include', $template ) )
   include $template;
 }}}
  - The changes to theme.php should probably be:
 {{{
 $ if ( $_template_file = apply_filters( 'template_include',
 $_template_file ) )
   require_once $_template_file;
 }}}
  - Do we continue using include and require_once respectively? Should we
 run file_exists and/or suppress errors?

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


More information about the wp-trac mailing list