Ensure that the post type object is the queried object when a post type has been registered with has_archive => true. Ensure it is not stomped when decorated with tax_query. Adds unit tests.

Props nacin.
Fixes #18614.



git-svn-id: https://develop.svn.wordpress.org/trunk@25291 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2013-09-06 22:06:40 +00:00
parent 63f35ba4b4
commit 48dc7e576b
5 changed files with 68 additions and 6 deletions
+15
View File
@@ -72,6 +72,21 @@ function get_archive_template() {
return get_query_template( 'archive', $templates );
}
/**
* Retrieve path of post type archive template in current or parent template.
*
* @since 3.7.0
*
* @return string
*/
function get_post_type_archive_template() {
$obj = get_post_type_object( get_query_var( 'post_type' ) );
if ( ! $obj->has_archive )
return '';
return get_archive_template();
}
/**
* Retrieve path of author template in current or parent template.
*