[wp-trac] [WordPress Trac] #13239: Filter locate_template template_names variable

WordPress Trac wp-trac at lists.automattic.com
Tue Sep 7 18:56:50 UTC 2010

#13239: Filter locate_template template_names variable
 Reporter:  chrisbliss18  |       Owner:                 
     Type:  enhancement   |      Status:  new            
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Themes        |     Version:  3.0            
 Severity:  normal        |    Keywords:  has-patch      

Comment(by coffee2code):

 In thinking about this a bit more, I do like what @chrisbliss18 what
 trying to achieve.  While I suggested a way to achieve it using my
 previous patch, it could be facilitated more directly with an amended
 patch, 13239.c2c.2.diff.  This patch incorporates my previous patch and
 introduces an additional hook, "locate_template_path-$template_name" which
 fires on a per-template_name basis.

 Like the intent of @chrisbliss18's original patch, this allows for a
 custom override location to be defined for a given template.  However,
 unlike the original patch this does not automatically trigger a
 `file_exists()` to achieve this.  Instead, it sends the filter an empty
 string as the default value.  Only if the hook actually returns a path
 will a `file_exists()` be attempted.

 Patch also adds PHPDocs about the filters.

Ticket URL: <http://core.trac.wordpress.org/ticket/13239#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list