Ticket #15337: 15337.patch
File 15337.patch, 1.1 KB (added by , 12 years ago) |
---|
-
wp-includes/template.php
313 313 * @return string 314 314 */ 315 315 function get_attachment_template() { 316 global $posts;316 $attachment = get_queried_object(); 317 317 318 if ( ! empty( $posts ) && isset( $posts[0]->post_mime_type ) ) { 319 $type = explode( '/', $posts[0]->post_mime_type ); 318 $templates = array(); 320 319 320 if ( $attachment ) { 321 $type = explode( '/', $attachment->post_mime_type ); 322 321 323 if ( ! empty( $type ) ) { 322 if ( $template = get_query_template( $type[0] ) ) 323 return $template; 324 elseif ( $template = get_query_template( $type[1] ) ) 325 return $template; 326 elseif ( $template = get_query_template( "$type[0]_$type[1]" ) ) 327 return $template; 324 $templates[] = "{$type[0]}.php"; 325 $templates[] = "{$type[1]}.php"; 326 $templates[] = "{$type[0]}_{$type[1]}.php"; 328 327 } 329 328 } 329 $templates[] = 'attachment.php'; 330 330 331 return get_query_template( 'attachment' );331 return get_query_template( 'attachment', $templates ); 332 332 } 333 333 334 334 /**