[wp-hackers] double loop with single-page layout in the second loop

Braydon ronin at braydon.com
Tue Aug 23 18:47:06 UTC 2011

For secondary queries it's better to use "get_posts" instead of 
"query_posts", query_posts is for the main query that's passed from the 
URL and will modify that one.

There is a query variable "numberposts" available for get_posts, since 
passing posts_per_page as a variable doesn't work......

On 08/23/2011 11:25 AM, Leo Baiano wrote:
>   Personnel, single page I want to display the post and a box with the other
> posts in the same category. I can do this, but in this box, I want to
> display only six posts in the same category and include paging, there starts
> the problem because it ap
> pears on page single method get_query_var('paged') always returns 0.
> My query_posts this way:
> query_posts ('posts_per_page = 6&  cat = 34&  paged ='. get_query_var
> ('paged'));
> Always display the first 6 posts in category 34, when I click on the
> Pagination she goes to the address with final / page / 2 but then is
> redirected to the address of the post, not keeping the / page / 2 in the
> url. Query_post a Test like this:
> query_posts ('posts_per_page = 6&  cat = 34&  paged = 2'));
> and thus works, it shows the next six posts, but how to make this happen
> dynamically?
> Could anyone give me a light?

More information about the wp-hackers mailing list