| 305 | | 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'); |
| | 305 | $object = get_queried_object(); |
| | 306 | |
| | 307 | $type = explode( '/', $object->post_mime_type ); |
| | 308 | |
| | 309 | $templates = array(); |
| | 310 | |
| | 311 | $templates[] = "{$type[0]}-{$type[1]}.php"; |
| | 312 | $templates[] = "{$type[1]}.php"; |
| | 313 | $templates[] = "{$type[0]}.php"; |
| | 314 | $templates[] = 'attachment.php'; |
| | 315 | |
| | 316 | return get_query_template( 'attachment', $templates ); |