Preserve the original query object as wp_the_query so that it's not stomped by subsequent calls to query_posts().

git-svn-id: http://svn.automattic.com/wordpress/trunk@4460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-11-09 06:50:58 +00:00
parent 37a9660885
commit 22bee1c9d7
3 changed files with 9 additions and 6 deletions

View File

@ -249,8 +249,9 @@ class WP {
} }
function query_posts() { function query_posts() {
global $wp_the_query;
$this->build_query_string(); $this->build_query_string();
query_posts($this->query_vars); $wp_the_query->query($this->query_vars);
} }
function handle_404() { function handle_404() {

View File

@ -11,8 +11,9 @@ function get_query_var($var) {
} }
function &query_posts($query) { function &query_posts($query) {
global $wp_query; unset($GLOBALS['wp_query']);
return $wp_query->query($query); $GLOBALS['wp_query'] =& new WP_Query();
return $GLOBALS['wp_query']->query($query);
} }
/* /*

View File

@ -226,9 +226,10 @@ $_SERVER = add_magic_quotes($_SERVER);
do_action('sanitize_comment_cookies'); do_action('sanitize_comment_cookies');
$wp_query = new WP_Query(); $wp_the_query =& new WP_Query();
$wp_rewrite = new WP_Rewrite(); $wp_query =& $wp_the_query;
$wp = new WP(); $wp_rewrite =& new WP_Rewrite();
$wp =& new WP();
validate_current_theme(); validate_current_theme();
define('TEMPLATEPATH', get_template_directory()); define('TEMPLATEPATH', get_template_directory());