Changeset 22293
- Timestamp:
- 10/25/2012 12:54:50 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/template.php
r21861 r22293 83 83 $templates = array(); 84 84 85 $templates[] = "author-{$author->user_nicename}.php"; 86 $templates[] = "author-{$author->ID}.php"; 85 if ( $author ) { 86 $templates[] = "author-{$author->user_nicename}.php"; 87 $templates[] = "author-{$author->ID}.php"; 88 } 87 89 $templates[] = 'author.php'; 88 90 … … 107 109 $templates = array(); 108 110 109 $templates[] = "category-{$category->slug}.php"; 110 $templates[] = "category-{$category->term_id}.php"; 111 if ( $category ) { 112 $templates[] = "category-{$category->slug}.php"; 113 $templates[] = "category-{$category->term_id}.php"; 114 } 111 115 $templates[] = 'category.php'; 112 116 … … 131 135 $templates = array(); 132 136 133 $templates[] = "tag-{$tag->slug}.php"; 134 $templates[] = "tag-{$tag->term_id}.php"; 137 if ( $tag ) { 138 $templates[] = "tag-{$tag->slug}.php"; 139 $templates[] = "tag-{$tag->term_id}.php"; 140 } 135 141 $templates[] = 'tag.php'; 136 142 … … 157 163 function get_taxonomy_template() { 158 164 $term = get_queried_object(); 159 $taxonomy = $term->taxonomy; 160 161 $templates = array(); 162 163 $templates[] = "taxonomy-$taxonomy-{$term->slug}.php"; 164 $templates[] = "taxonomy-$taxonomy.php"; 165 166 $templates = array(); 167 168 if ( $term ) { 169 $taxonomy = $term->taxonomy; 170 $templates[] = "taxonomy-$taxonomy-{$term->slug}.php"; 171 $templates[] = "taxonomy-$taxonomy.php"; 172 } 165 173 $templates[] = 'taxonomy.php'; 166 174 … … 281 289 $templates = array(); 282 290 283 $templates[] = "single-{$object->post_type}.php"; 291 if ( $object ) 292 $templates[] = "single-{$object->post_type}.php"; 284 293 $templates[] = "single.php"; 285 294 … … 304 313 function get_attachment_template() { 305 314 global $posts; 306 $type = explode('/', $posts[0]->post_mime_type); 307 if ( $template = get_query_template($type[0]) ) 308 return $template; 309 elseif ( $template = get_query_template($type[1]) ) 310 return $template; 311 elseif ( $template = get_query_template("$type[0]_$type[1]") ) 312 return $template; 313 else 314 return get_query_template('attachment'); 315 316 if ( ! empty( $posts ) && isset( $posts[0]->post_mime_type ) ) { 317 $type = explode( '/', $posts[0]->post_mime_type ); 318 319 if ( ! empty( $type ) ) { 320 if ( $template = get_query_template( $type[0] ) ) 321 return $template; 322 elseif ( $template = get_query_template( $type[1] ) ) 323 return $template; 324 elseif ( $template = get_query_template( "$type[0]_$type[1]" ) ) 325 return $template; 326 } 327 } 328 329 return get_query_template( 'attachment' ); 315 330 } 316 331
Note: See TracChangeset
for help on using the changeset viewer.