mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Ensure that get_archive_template() only loads a post type archive (archive-$post_type.php file) if there is exactly one post type in the query.
props scribu. see #22956. for trunk. git-svn-id: https://develop.svn.wordpress.org/trunk@23249 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user