Set queried object on CPT archives. Fixes #15730

git-svn-id: http://svn.automattic.com/wordpress/trunk@16792 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
scribu 2010-12-08 08:57:38 +00:00
parent 2be192c80e
commit 39d0718bff
2 changed files with 3 additions and 2 deletions

View File

@ -667,8 +667,7 @@ function post_type_archive_title( $prefix = '', $display = true ) {
if ( ! is_post_type_archive() ) if ( ! is_post_type_archive() )
return; return;
$post_type_obj = get_queried_object();
$post_type_obj = get_post_type_object( get_query_var( 'post_type' ) );
$title = apply_filters('post_type_archive_title', $post_type_obj->labels->name ); $title = apply_filters('post_type_archive_title', $post_type_obj->labels->name );
if ( $display ) if ( $display )

View File

@ -2675,6 +2675,8 @@ class WP_Query {
$this->queried_object = $term; $this->queried_object = $term;
$this->queried_object_id = (int) $term->term_id; $this->queried_object_id = (int) $term->term_id;
} }
} elseif ( $this->is_post_type_archive ) {
$this->queried_object = get_post_type_object( $this->get('post_type') );
} elseif ( $this->is_posts_page ) { } elseif ( $this->is_posts_page ) {
$page_for_posts = get_option('page_for_posts'); $page_for_posts = get_option('page_for_posts');
$this->queried_object = & get_page( $page_for_posts ); $this->queried_object = & get_page( $page_for_posts );