X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/6c8f14c09105d0afa4c1574215c59b5021040e76..61343b82c4f0da4c68e4c6373daafff4a81efdd1:/wp-includes/template.php diff --git a/wp-includes/template.php b/wp-includes/template.php index d86a677f..5bee8ad5 100644 --- a/wp-includes/template.php +++ b/wp-includes/template.php @@ -59,12 +59,14 @@ function get_404_template() { * @return string */ function get_archive_template() { - $post_types = get_query_var( 'post_type' ); + $post_types = array_filter( (array) get_query_var( 'post_type' ) ); $templates = array(); - foreach ( (array) $post_types as $post_type ) + if ( count( $post_types ) == 1 ) { + $post_type = reset( $post_types ); $templates[] = "archive-{$post_type}.php"; + } $templates[] = 'archive.php'; return get_query_template( 'archive', $templates ); @@ -94,8 +96,8 @@ function get_author_template() { /** * Retrieve path of category template in current or parent template. * - * Works by first retrieving the current slug for example 'category-default.php' and then - * trying category ID, for example 'category-1.php' and will finally fallback to category.php + * Works by first retrieving the current slug, for example 'category-default.php', and then + * trying category ID, for example 'category-1.php', and will finally fall back to category.php * template, if those files don't exist. * * @since 1.5.0 @@ -120,8 +122,8 @@ function get_category_template() { /** * Retrieve path of tag template in current or parent template. * - * Works by first retrieving the current tag name, for example 'tag-wordpress.php' and then - * trying tag ID, for example 'tag-1.php' and will finally fallback to tag.php + * Works by first retrieving the current tag name, for example 'tag-wordpress.php', and then + * trying tag ID, for example 'tag-1.php', and will finally fall back to tag.php * template, if those files don't exist. * * @since 2.3.0 @@ -189,7 +191,7 @@ function get_date_template() { /** * Retrieve path of home template in current or parent template. * - * This is the template used for the page containing the blog posts + * This is the template used for the page containing the blog posts. * * Attempts to locate 'home.php' first before falling back to 'index.php'. * @@ -223,9 +225,9 @@ function get_front_page_template() { /** * Retrieve path of page template in current or parent template. * - * Will first look for the specifically assigned page template - * The will search for 'page-{slug}.php' followed by 'page-id.php' - * and finally 'page.php' + * Will first look for the specifically assigned page template. + * Then will search for 'page-{slug}.php', followed by 'page-{id}.php', + * and finally 'page.php'. * * @since 1.5.0 *