WordPress.org

Make WordPress Core

Ticket #25558: general-template.patch

File general-template.patch, 923 bytes (added by Horttcore, 8 years ago)

diff patch

  • .php

    old new  
    119119 * @param string $slug The slug name for the generic template.
    120120 * @param string $name The name of the specialised template.
    121121 */
    122 function get_template_part( $slug, $name = null ) {
    123         do_action( "get_template_part_{$slug}", $slug, $name );
     122function get_template_part() {
     123        $partials = array_filter( func_get_args() );
     124        do_action( "get_template_part_{$slug}", $partials[0], $partials[1], $partials ); // $partials[1] for compability
    124125
    125126        $templates = array();
    126         $name = (string) $name;
    127         if ( '' !== $name )
    128                 $templates[] = "{$slug}-{$name}.php";
    129 
    130         $templates[] = "{$slug}.php";
     127        if ( $partials )
     128                foreach( $partials as $partial ) {
     129                        $templates[] = implode( '-', $partials ) . '.php';
     130                        array_pop($partials);
     131                }
    131132
    132133        locate_template($templates, true, false);
    133134}