Ticket #25291: 25291.diff
File 25291.diff, 1.9 KB (added by , 11 years ago) |
---|
-
src/wp-includes/template.php
83 83 $post_type = get_query_var( 'post_type' ); 84 84 if ( is_array( $post_type ) ) 85 85 $post_type = reset( $post_type ); 86 86 87 87 $obj = get_post_type_object( $post_type ); 88 88 if ( ! $obj->has_archive ) 89 89 return ''; … … 103 103 104 104 $templates = array(); 105 105 106 if ( $author) {106 if ( is_a( $author, 'WP_User' ) ) { 107 107 $templates[] = "author-{$author->user_nicename}.php"; 108 108 $templates[] = "author-{$author->ID}.php"; 109 109 } … … 129 129 130 130 $templates = array(); 131 131 132 if ( $category) {132 if ( ! empty( $category->slug ) ) { 133 133 $templates[] = "category-{$category->slug}.php"; 134 134 $templates[] = "category-{$category->term_id}.php"; 135 135 } … … 155 155 156 156 $templates = array(); 157 157 158 if ( $tag) {158 if ( ! empty( $tag->slug ) ) { 159 159 $templates[] = "tag-{$tag->slug}.php"; 160 160 $templates[] = "tag-{$tag->term_id}.php"; 161 161 } … … 186 186 187 187 $templates = array(); 188 188 189 if ( $term) {189 if ( ! empty( $term->slug ) ) { 190 190 $taxonomy = $term->taxonomy; 191 191 $templates[] = "taxonomy-$taxonomy-{$term->slug}.php"; 192 192 $templates[] = "taxonomy-$taxonomy.php"; … … 310 310 311 311 $templates = array(); 312 312 313 if ( $object)313 if ( ! empty( $object->post_type ) ) 314 314 $templates[] = "single-{$object->post_type}.php"; 315 315 $templates[] = "single.php"; 316 316 … … 341 341 if ( ! empty( $type ) ) { 342 342 if ( $template = get_query_template( $type[0] ) ) 343 343 return $template; 344 elseif ( $template = get_query_template( $type[1] ) ) 345 return $template; 346 elseif ( $template = get_query_template( "$type[0]_$type[1]" ) ) 347 return $template; 344 elseif ( ! empty( $type[1] ) ) { 345 if ( $template = get_query_template( $type[1] ) ) 346 return $template; 347 elseif ( $template = get_query_template( "$type[0]_$type[1]" ) ) 348 return $template; 349 } 348 350 } 349 351 } 350 352