[wp-trac] [WordPress Trac] #15086: get_template_part() should let you specify a directory

WordPress Trac wp-trac at lists.automattic.com
Wed Nov 16 23:49:58 UTC 2011


#15086: get_template_part() should let you specify a directory
-------------------------------------------------+-------------------------
 Reporter:  aaroncampbell                        |       Owner:  westi
     Type:  enhancement                          |      Status:  accepted
 Priority:  normal                               |   Milestone:  Future
Component:  Themes                               |  Release
 Severity:  normal                               |     Version:  3.0
 Keywords:  has-patch 3.3-early westi-likes      |  Resolution:
  needs-unit-tests                               |
-------------------------------------------------+-------------------------

Comment (by scribu):

 As I've said previously, I don't really see the benefit of a $directory
 parameter, as implemented in this patch.

 What would be interesting if it were a boolean parameter, which, when set
 to true, would give "{$slug}/{$name}.php", instead of
 "{$slug}-{$name}.php".

 So, with {{{$dir = false}}}:

 {{{
 /theme/loop.php
 /theme/loop-category.php
 /theme/loop-default.php
 }}}

 and with {{{$dir = true}}}:

 {{{
 /theme/loop.php
 /theme/loop/category.php
 /theme/loop/default.php
 }}}

 This way, you actually increase the flexibility of get_template_part(),
 instead of merely adding another syntax for the same thing.

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


More information about the wp-trac mailing list