Ticket #15337: 15337.3.patch
File 15337.3.patch, 1.5 KB (added by , 12 years ago) |
---|
-
wp-includes/template.php
306 306 * 'attachment.php' is checked and returned. 307 307 * 308 308 * Some examples for the 'text/plain' mime type are 'text.php', 'plain.php', and 309 * finally 'text _plain.php'.309 * finally 'text-plain.php'. 310 310 * 311 311 * @since 2.0.0 312 312 * 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]}-{$type[1]}.php"; 325 $templates[] = "{$type[1]}.php"; 326 $templates[] = "{$type[0]}.php"; 328 327 } 329 328 } 329 $templates[] = 'attachment.php'; 330 330 331 return get_query_template( 'attachment' ); 331 $template = get_query_template( 'attachment', $templates ); 332 $template = apply_filters( "{$type[0]}_template", $template ); 333 $template = apply_filters( "{$type[1]}_template", $template ); 334 $template = apply_filters( "{$type[0]}_{$type[1]}_template", $template ); 335 336 return $template; 332 337 } 333 338 334 339 /**