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

WordPress Trac wp-trac at lists.automattic.com
Wed Jul 14 21:00:54 UTC 2010


#12877: Modular themes: Apply template hierarchy to folders within a theme
-----------------------------+----------------------------------------------
 Reporter:  koopersmith      |       Owner:                
     Type:  feature request  |      Status:  new           
 Priority:  normal           |   Milestone:  Future Release
Component:  Themes           |     Version:  3.0           
 Severity:  normal           |    Keywords:  has-patch     
-----------------------------+----------------------------------------------

Comment(by scribu):

 With the current patch, trying to alter the top-level hierarchy causes
 problems:

 Say I want to add an 'author-{role}.php' top-level template. So, I hook
 into 'author_template':

 {{{
 function author_role_template( $old_template ) {
   // get current author's role

   $new_template = locate_template( array( "author-$role.php" ) );

   if( $new_template )
     return $new_template;

   return $old_template;
 }
 }}}

 update_template_hierarchy(); will miss that, so you won't have access to
 "/module/author-editor.php" etc.

 What would be needed is a filter applied to the array before it's passed
 to locate_template():

 {{{
 $templates = apply_filters( 'author_template_pre', $templates );

 $template = locate_template( $templates );
 }}}

 Actually, I think that would be useful independent of the current
 proposal. I'll oepn a separate ticket.

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


More information about the wp-trac mailing list