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

WordPress Trac noreply at wordpress.org
Fri Oct 7 15:44:25 UTC 2016


#13239: Filter locate_template template_names variable
-------------------------+-----------------------------
 Reporter:  chrisjean    |       Owner:
     Type:  enhancement  |      Status:  reopened
 Priority:  normal       |   Milestone:  Future Release
Component:  Themes       |     Version:  3.0
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:
-------------------------+-----------------------------

Comment (by tifosi):

 +1

 Would really appreciate this. Very strange that this is not done,
 particularly as it's possible for main templates such as page.php etc via
 the template_include filter. Something that a lot of plugins such as
 woocommerce use for custom theming.

 But, not possible for template partials such as header.php, which hook
 into the non-filterable locate_template.

 A single locate_template filter would alleviate this and allow for a
 cleaner/leaner theme directory structure.

 I know it's possible - as used in get_template_part() to use a relative
 path in the first argument, but that's a really clunky hack that needs
 some rethought.

 A theme being able to on-the-fly restructure the subfolder destinations
 for template files & partials would be extremely useful... and just a
 single filter!

 Come on guys... this has been going on for 6 years!

 Thanks

--
Ticket URL: <https://core.trac.wordpress.org/ticket/13239#comment:103>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list