WordPress.org

Make WordPress Core

Ticket #15337: 16230.diff

File 16230.diff, 842 bytes (added by willnorris, 8 years ago)
  • wp-includes/theme.php

     
    10291029function get_attachment_template() {
    10301030        global $posts;
    10311031        $type = explode('/', $posts[0]->post_mime_type);
    1032         if ( $template = get_query_template($type[0]) )
    1033                 return $template;
    1034         elseif ( $template = get_query_template($type[1]) )
    1035                 return $template;
    1036         elseif ( $template = get_query_template("$type[0]_$type[1]") )
    1037                 return $template;
    1038         else
    1039                 return get_query_template('attachment');
     1032
     1033        $templates = array();
     1034
     1035        $templates[] = "{$type[0]}.php";
     1036        $templates[] = "{$type[1]}.php";
     1037        $templates[] = "{$type[0]}_{$type[1]}.php";
     1038        $templates[] = 'attachment.php';
     1039
     1040        return get_query_template( 'attachment', $templates );
    10401041}
    10411042
    10421043/**