[wp-trac] [WordPress Trac] #23142: Make it possible to "stem" an arbitrary prefix with the Template Hierarchy's "stemming" logic.

WordPress Trac noreply at wordpress.org
Tue Jan 8 20:28:06 UTC 2013


#23142: Make it possible to "stem" an arbitrary prefix with the Template
Hierarchy's "stemming" logic.
-----------------------------+------------------------------
 Reporter:  rulatir          |       Owner:
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Themes           |     Version:  3.5
 Severity:  normal           |  Resolution:
 Keywords:                   |
-----------------------------+------------------------------
Changes (by rulatir):

 * keywords:  close =>


Comment:

 Replying to [comment:1 helen]:
 > Not completely sure I'm reading this right, but sounds like you're
 asking for exactly what `get_template_part()` does.

 No, in your example you hardcode the 'index' part. I want to be able to
 instead '''execute the template hierarchy logic''' to determine that part
 exactly the way template_loader.php determines it when loading the main
 template file.

 In other words, at the point in a generic layout template where I expect
 to place this '''call''':

 {{{
 <?php locate_template(wp_template_candidates('loops/'), true); ?>
 }}}

 ... at this point I don't know (and in fact want to abstract away) whether
 we are showing the homepage, a single post, a category archive, or a
 category archive for category "foo". If these are four special cases for
 which I want to use different loop template parts, then I want to be able
 to create these template parts in the loops/ subdirectory, and get them
 automatically picked up in appropriate cases.

 In yet other words, I want to be able to defer the '''whole''' template
 hierarchy logic to the moment(s) when I load specific template parts.
 Unfortunately get_template_part cannot do that. It only does child theme
 to parent theme fallback.

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


More information about the wp-trac mailing list