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

WordPress Trac noreply at wordpress.org
Sun Mar 9 20:53:40 UTC 2014


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

Comment (by MikeSchinkel):

 Replying to [comment:71 nacin]:
 > As I've also argued previously (elsewhere, apparently), a huge benefit
 of the template hierarchy in WordPress is that it's predictable. You can
 open up any theme and understand how it works. It's one of the most
 important and easy-to-understand concepts in WordPress.

 Gotta agree with this.  Standardization is super important.

 > That said, rmccue has been kicking around an alternative idea that would
 allow one to filter the directories in which a file is searched. See
 #27322 .

 Yes, this is really nice and would address the 'skins' use-case I
 mentioned above.

 Replying to [comment:72 casben79]:
 > `locate_template()` is also used in `get_template_part()` which really
 has nothing to do with the overall template hierarchy.

 Gotta agree with that, too, because that's where some of the biggest
 limitations come from. And also `get_header()` and `get_footer()`.

 > The overall hierarchy is already very easy to butcher at the moment
 using the `template_include` filter, which is at the moment the only place
 my plugin can effect the changes people make to the templates.

 And that it true too. Currently if people want to butcher it they can.
 They just do it in less standardized ways.

 So…I think casben79 identified the biggest pain point, the template parts
 (and the headers and footers.) Maybe we could enable them to be changed?
 I've had to bypass `get_template_part()` in some of my projects because
 the simple two level hierarchy stored in the theme root doesn't allow for
 maintainable template parts.

 Or, maybe it's time to **consider adding more robust template parts
 hierarchy** to address complex use-cases?

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


More information about the wp-trac mailing list