[wp-trac] [WordPress Trac] #43597: Modify template-loader engine

WordPress Trac noreply at wordpress.org
Thu Oct 3 10:12:02 UTC 2019


#43597: Modify template-loader engine
-------------------------+------------------------------
 Reporter:  chespir      |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Themes       |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:  template
-------------------------+------------------------------

Comment (by chespir):

 Replying to [comment:6 dhurlburtusa]:
 > Note: The proposed solution here is very similar to the one in #48175.
 The difference being that there is a filter named
 `template_resolution_algorithm` which runs the default template hierarchy
 algorithm as the template resolution algorithm (TRA). The benefit being
 that one can easily override the TRA. It also encapsulates the current
 template hierarchy algorithm in a function which could be used else where.
 It could even be used in the custom TRA depending on the request.

 Just to join criteria

 I suggested in first post of this topic to add TRA to the
 {{{template_include}}} filter with priority 1 so that you can
 {{{remove_filter}}} and add your own algorithm. Similar to your nice
 example.
 Wrapping TRA in a function may also be helpull when you need to invoke
 WordPress TRA (or your own algorithm) when you need.

 I think the issues we are talking about are:
 1. To wrap WordPress TRA in a function
 2. To be able to let Wordpress to use its own TRA (the function in point
 one) or other algorithm. Like this, point 1 ans 2 would let you build a
 theme with an MVC-like architecture as you also mentioned
 3. As a consequence of the previous point, there would be a filter in
 which would be hooked the default Wordpress TRA. In this way, point two
 would be possible

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


More information about the wp-trac mailing list