Fix displaying pages and attachments, props dd32, see #10605

git-svn-id: http://svn.automattic.com/wordpress/trunk@11822 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2009-08-15 10:57:56 +00:00
parent 73de56d05e
commit 42471b4882
1 changed files with 3 additions and 2 deletions

View File

@ -1596,7 +1596,7 @@ class WP_Query {
if ( $this->is_search ) if ( $this->is_search )
$q['post_type'] = 'any'; $q['post_type'] = 'any';
else else
$q['post_type'] = 'post'; $q['post_type'] = '';
} }
$post_type = $q['post_type']; $post_type = $q['post_type'];
if ( !isset($q['posts_per_page']) || $q['posts_per_page'] == 0 ) if ( !isset($q['posts_per_page']) || $q['posts_per_page'] == 0 )
@ -2078,8 +2078,9 @@ class WP_Query {
$where .= " AND $wpdb->posts.post_type = 'attachment'"; $where .= " AND $wpdb->posts.post_type = 'attachment'";
} elseif ($this->is_page) { } elseif ($this->is_page) {
$where .= " AND $wpdb->posts.post_type = 'page'"; $where .= " AND $wpdb->posts.post_type = 'page'";
} elseif ($this->is_single) { } else {
$where .= " AND $wpdb->posts.post_type = 'post'"; $where .= " AND $wpdb->posts.post_type = 'post'";
$post_type = 'post';
} }
if ( isset($q['post_status']) && '' != $q['post_status'] ) { if ( isset($q['post_status']) && '' != $q['post_status'] ) {