[wp-trac] [WordPress Trac] #25558: Smarter get_template_part() function

WordPress Trac noreply at wordpress.org
Thu Oct 10 19:07:49 UTC 2013


#25558: Smarter get_template_part() function
-------------------------+-----------------------------------
 Reporter:  Horttcore    |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Template     |    Version:  trunk
 Severity:  trivial      |   Keywords:  2nd-opinion has-patch
-------------------------+-----------------------------------
 The get_template_part() function could be much smarter if it takes any
 number or arguments.

 {{{
 function get_template_part() {
         $partials = array_filter( func_get_args() );
         do_action( "get_template_part_{$slug}", $args[0], $args[1], $args
 ); // $args[1] for compability

         $templates = array();
         if ( $partials )
                 foreach( $partials as $partial ) {
                         $templates[] = implode( '-', $partials ) . '.php';
                         array_pop($partials);
                 }

         locate_template($templates, true, false);
 }
 }}}

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


More information about the wp-trac mailing list