[wp-hackers] query_posts() issues

Robert Deaton false.hopes at gmail.com
Tue Aug 1 15:52:35 GMT 2006


On 8/1/06, R.J. Kaplan <just.be.happy at gmail.com> wrote:
> <?php
> $next = get_next_post();
> $prev = get_previous_post();
> query_posts("p=$prev->ID&showposts=1");
> ?>
> ... the loop ...
> <?php
> query_posts("p=$next->ID&showposts=1");
> ?>
> ... the loop ...
>
> the first query works fine, the second just shows the same post as the main
> post on the page. if i reverse them, still it's only the first one that
> works fine.
> Any ideas?

get_previous_post() and get_next_post() will be influenced by any
thing you do with query_posts() and/or the loop, so its best to store
the value before you start doing things.

-- 
--Robert Deaton


More information about the wp-hackers mailing list