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

WordPress Trac wp-trac at lists.automattic.com
Thu Feb 24 21:23:48 UTC 2011


#13239: Filter locate_template template_names variable
---------------------------------+-----------------------------
 Reporter:  chrisbliss18         |       Owner:
     Type:  enhancement          |      Status:  new
 Priority:  normal               |   Milestone:  Future Release
Component:  Themes               |     Version:  3.0
 Severity:  normal               |  Resolution:
 Keywords:  has-patch 3.2-early  |
---------------------------------+-----------------------------
Changes (by andrewlawson):

 * cc: andrewlawson (added)


Comment:

 My patch wasn't to replace your's, I'd simply written it before I came
 across this ticket.

 I can see the benefit of filtering $template_name instead of a list of
 directories, although there could be a problem with your patch:

 Windows systems don't use '/' at the beginning of absolute paths, so
 {{{
 if ( $template_name{0} == '/' && file_exists( $template_name ) ) {
 }}}
 on line 1084 won't work. The only way to get around that is to just do
 {{{
 if ( file_exists( $template_name ) ) {
 }}}
 but that may cause problems for non-absolute paths depending on where the
 filter callback is defined.

 I know windows isn't ideal for development, never mind production, yet
 it's still used for both, and needs to be accommodated for.

 The only solution I can see is to use two filters, one to filter a list of
 directories, and another to filter the template names.

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


More information about the wp-trac mailing list