Ticket #12105: singular-template.diff
File singular-template.diff, 1.4 KB (added by , 15 years ago) |
---|
-
template-loader.php
36 36 } else if ( is_page() && $template = get_page_template() ) { 37 37 include($template); 38 38 return; 39 } else if ( is_singular() && $template = get_page_template() ) { 40 include( $template ); 41 return; 39 42 } else if ( is_category() && $template = get_category_template()) { 40 43 include($template); 41 44 return; -
theme.php
895 895 } 896 896 897 897 /** 898 * Retrieve the path of the singular template in current or parent template. 899 * 900 * @since 0.3 901 * 902 * @return string 903 */ 904 function get_singular_template() { 905 global $wp_query; 906 907 $id = (int) $wp_query->post->ID; 908 909 $templates = array(); 910 $templates[] = "{$wp_query->post->post_type}-{$wp_query->post->post_name}.php"; 911 $templates[] = "{$wp_query->post->post_type}-{$id}.php"; 912 $templates[] = "{$wp_query->post->post_type}.php"; 913 $templates[] = "singular.php"; 914 915 return apply_filters( 'singular_template', locate_template( $templates ) ); 916 } 917 918 /** 898 919 * Retrieve path of attachment template in current or parent template. 899 920 * 900 921 * The attachment path first checks if the first part of the mime type exists.