Changeset 16115
- Timestamp:
- 10/31/2010 11:23:10 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/theme.php
r16114 r16115 801 801 */ 802 802 function get_author_template() { 803 $author_id = absint( get_query_var( 'author' ) ); 804 $author = get_user_by( 'id', $author_id ); 805 $author = $author->user_nicename; 803 $author = get_queried_object(); 806 804 807 805 $templates = array(); 808 806 809 if ( $author ) 810 $templates[] = "author-{$author}.php"; 811 if ( $author_id ) 812 $templates[] = "author-{$author_id}.php"; 807 $templates[] = "author-{$author->user_nicename}.php"; 808 $templates[] = "author-{$author->ID}.php"; 813 809 $templates[] = 'author.php'; 814 810 … … 829 825 */ 830 826 function get_category_template() { 831 $cat_ID = absint( get_query_var('cat') ); 832 $category = get_category( $cat_ID ); 827 $category = get_queried_object(); 833 828 834 829 $templates = array(); 835 830 836 if ( !is_wp_error( $category ) ) 837 $templates[] = "category-{$category->slug}.php"; 838 839 $templates[] = "category-$cat_ID.php"; 831 $templates[] = "category-{$category->slug}.php"; 832 $templates[] = "category-{$category->term_id}.php"; 840 833 $templates[] = "category.php"; 841 834 … … 857 850 function get_tag_template() { 858 851 $tag = get_queried_object(); 859 $tag_name = $tag->slug;860 $tag_id = $tag->term_id;861 852 862 853 $templates = array(); 863 854 864 if ( $tag_name ) 865 $templates[] = "tag-$tag_name.php"; 866 if ( $tag_id ) 867 $templates[] = "tag-$tag_id.php"; 855 $templates[] = "tag-{$tag->slug}.php"; 856 $templates[] = "tag-{$tag->term_id}.php"; 868 857 $templates[] = "tag.php"; 869 858 … … 889 878 */ 890 879 function get_taxonomy_template() { 891 $t axonomy = get_query_var('taxonomy');892 $t erm = get_query_var('term');880 $term = get_queried_object(); 881 $taxonomy = $term->taxonomy; 893 882 894 883 $templates = array(); 895 if ( $taxonomy && $term ) 896 $templates[] = "taxonomy-$taxonomy-$term.php"; 897 if ( $taxonomy ) 898 $templates[] = "taxonomy-$taxonomy.php"; 899 884 885 $templates[] = "taxonomy-$taxonomy-{$term->slug}.php"; 886 $templates[] = "taxonomy-$taxonomy.php"; 900 887 $templates[] = "taxonomy.php"; 901 888 … … 1016 1003 function get_single_template() { 1017 1004 $object = get_queried_object(); 1018 $templates = array('single-' . $object->post_type . '.php', 'single.php'); 1005 1006 $templates = array(); 1007 1008 $templates[] = "single-{$object->post_type}.php"; 1009 $templates[] = "single.php"; 1019 1010 1020 1011 return get_query_template( 'single', $templates );
Note: See TracChangeset
for help on using the changeset viewer.