Ticket #12105: singular_template_post_types.diff
File singular_template_post_types.diff, 1.1 KB (added by , 15 years ago) |
---|
-
wp-includes/theme.php
897 897 898 898 /** 899 899 * Retrieve path of single template in current or parent template. 900 * 901 * Will first look for singular-{post_type}-{slug}.php 902 * The will search for 'singular-{post_type}-{id}.php' followed by 'singular-{post_type}.php', 903 * and finally 'singular.php' 900 904 * 901 905 * @since 1.5.0 902 906 * 903 907 * @return string 904 908 */ 905 909 function get_single_template() { 906 return get_query_template('single'); 910 global $wp_query; 911 912 $id = (int) $wp_query->post->ID; 913 914 $templates = array(); 915 $templates[] = "singular-{$wp_query->post->post_type}-{$wp_query->post->post_name}.php"; 916 $templates[] = "singular-{$wp_query->post->post_type}-{$id}.php"; 917 $templates[] = "singular-{$wp_query->post->post_type}.php"; 918 $templates[] = "singular.php"; 919 $templates[] = "single.php"; // Deprecated, use singular.php instead 920 921 return apply_filters('single_template', locate_template($templates)); 907 922 } 908 923 909 924 /**