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

Ricardo Moraleida moraleida at gmail.com
Tue Aug 23 18:57:58 UTC 2011


I'd say perhaps the best way to achieve that is using a WP_Query object
instead of query_posts for your secondary loops.

See this ->
http://wordpress.stackexchange.com/questions/1753/when-should-you-use-wp-query-vs-query-posts-vs-get-posts

i've done a fair bit of secondary loops inside one single page, often using
different page templates and it works wonders for me.


Ricardo Moraleida



2011/8/23 Leo Baiano <ljunior2005 at gmail.com>

>  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?
>
> --
> Amplexos,
>
> Leo Baiano
> http://www.leobaiano.com
> http://www.blog.ljunior.com
> http://www.mcelebridades.com
> http://www.twitter.com/leobaiano
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list