[wp-trac] [WordPress Trac] #16128: WordPress Template System Override

WordPress Trac wp-trac at lists.automattic.com
Thu Jan 6 22:29:00 UTC 2011


#16128: WordPress Template System Override
-----------------------------------------+-------------------------
 Reporter:  pearsonified                 |       Owner:
     Type:  feature request              |      Status:  closed
 Priority:  normal                       |   Milestone:
Component:  Themes                       |     Version:  3.1
 Severity:  normal                       |  Resolution:  worksforme
 Keywords:  has-patch 2nd-opinion close  |
-----------------------------------------+-------------------------

Comment (by pearsonified):

 Replying to [comment:12 nacin]:
 > Replying to [comment:8 pearsonified]:
 > > Nacin, the problem with not changing anything is that you cannot
 prevent the rest of the template-loader.php file from running, as Nathan
 mentioned in his response to duck_ above.
 > >
 > > Any thoughts on that end of things?
 >
 > Yep. I hinted to it in my last comment, but -- nothing else runs after
 template loader. So just `exit` or `die` when you're done to kill the
 script. Including the `die` is pretty standard whenever you need to use
 template_redirect to load a template, because whenever a plugin wants to
 override that, they'll need to stop the rest of the template hierarchy
 from firing. This is standard practice in plugins, and it really isn't
 that inelegant at all. Again, nothing else ever fires after the template
 loader -- imagine a die() at the end of the file already. You're just
 short-circuiting it.
 >
 > Make sense? I better understand the problem and use case that you and
 Nathan laid out, and I'm confident this is the exact hook you're looking
 for, so I'm closing this as worksforme.
 >
 > Cheers :-)

 Andrew, thanks for the response!

 I suppose the bigger question here is this: The template system is
 designed to work one specific way, but it can be hax0red to work
 differently with the template_redirect hook. Instead of requiring a hook
 for modification, why not treat all template systems the exact same by
 firing them at one, consistent time? If the developer chooses which system
 to show, I don't see why this would be a problem for anyone.

 From a more general standpoint, I'm suggesting that any template system
 should be considered to be of type X, regardless of whether it's the
 standard WP template system or a new one that no one has built yet.
 However, under the current (unchanged) construct, you have two template
 system types: X and Y, where Y is any template type that is fired from the
 template_redirect hook.

 The coder in me sincerely wants to consolidate these different types into
 one, unified structure. IMO, it's the right thing to do.

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


More information about the wp-trac mailing list