[theme-reviewers] Mini-Site Theme query_posts use

Philip M. Hofer (Frumph) philip at frumph.net
Mon Aug 30 15:41:46 UTC 2010


Righteous, thanks info.
However, dependant on the loop and it's position if something else already 
modifies the query and you need to revert back to the modified query already 
in progress.


- Phil
----- Original Message ----- 
From: "Otto" <otto at ottodestruct.com>
To: <theme-reviewers at lists.wordpress.org>
Sent: Monday, August 30, 2010 8:33 AM
Subject: Re: [theme-reviewers] Mini-Site Theme query_posts use


> On Mon, Aug 30, 2010 at 9:59 AM, Philip M. Hofer (Frumph)
> <philip at frumph.net> wrote:
>> Nevermind I see it, header.php has
>>
>> //The Query
>> query_posts('posts_per_page=10');
>>
>> Which basically overrides any common loop that occures then does a
>> wp_reset_query(), he should be protecting that loops $wp_query and
>> restarting the old wp_query after that loop of links happens.
>>
>> $temp_wp_query = $wp_query;
>>
>> <code>
>>
>> $wp_query = temp_wp_query;
>>
>> sort of thing.
>>
>> *or* not use query_posts and creates a new WP_Query which is the better 
>> way
>> of handling that.
>
> You're correct about the better way, but having to save the $wp_query
> variable yourself in a temp var is not really necessary, because
> that's exactly what wp_reset_query does.
>
> The $wp_query global is just a reference to the $wp_the_query global.
> wp_reset_query() basically just unsets the $wp_query and resets it
> back to being a reference to the $wp_the_query global.
>
> -Otto
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
> 




More information about the theme-reviewers mailing list