[wp-trac] [WordPress Trac] #12877: Modular themes: Apply template heirarchy to folders within a theme

WordPress Trac wp-trac at lists.automattic.com
Tue Apr 6 16:26:15 UTC 2010


#12877: Modular themes: Apply template heirarchy to folders within a theme
-------------------------+--------------------------------------------------
 Reporter:  koopersmith  |       Owner:            
     Type:  enhancement  |      Status:  new       
 Priority:  normal       |   Milestone:  Unassigned
Component:  Template     |     Version:            
 Severity:  normal       |    Keywords:            
-------------------------+--------------------------------------------------
 Applying template heirarchy to folders within a theme will allow themes to
 be broken into modules, allowing theme developers to substantially reduce
 repeated code. This is an automated, complete version of the use of
 get_template_part() in Twenty Ten.

 I've written posts on the [http://wp.me/pS0xt-1f justification for modular
 themes] and [http://wp.me/pS0xt-30 their potential to transform theme
 organization].

 Based on [http://wp.me/pS0xt-3O my tests], these functions should cause no
 noticeable difference in performance.

 The patch has the added benefit of creating an accurate global
 $wp_template_hierarchy object (and a getter method), so any plugin/theme
 can access the template hierarchy for $wp_query.

 The patch introduces several new functions: get_template_module($folder),
 get_template_hierarchy(), update_template_hierarchy(), and 2 private
 functions.

 Finally, the patch also add a 'locate_template' filter on $template_names
 at the beginning of locate_template(), and turns the large conditional in
 template-loader.php into a function: template_loader().

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12877>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list