WordPress.org

Make WordPress Core

Ticket #21053: template.php.2.patch

File template.php.2.patch, 971 bytes (added by jfarthing84, 6 years ago)

Change underscore to dash in most specific scenario of attachment template.

  • wp-includes/template.php

     
    303303 */
    304304function get_attachment_template() {
    305305        global $posts;
    306         $type = explode('/', $posts[0]->post_mime_type);
    307         if ( $template = get_query_template($type[0]) )
    308                 return $template;
    309         elseif ( $template = get_query_template($type[1]) )
    310                 return $template;
    311         elseif ( $template = get_query_template("$type[0]_$type[1]") )
    312                 return $template;
    313         else
    314                 return get_query_template('attachment');
     306
     307        $type = explode( '/', $posts[0]->post_mime_type );
     308
     309        if ( $template = get_query_template( "$type[0]-$type[1]" ) )
     310                return $template;
     311        elseif ( $template = get_query_template( $type[1] ) )
     312                return $template;
     313        elseif ( $template = get_query_template( $type[0] ) )
     314                return $template;
     315        else
     316                return get_query_template( 'attachment' );
    315317}
    316318
    317319/**