Here's the layout, I'd like to achieve.
- 1st row: three posts in three columns from category A
- 2nd row: one fullwidth post from category B
- 3rd row: the next three posts from category A
- 4th row: the next post from category B
- etc.
It looks like this:
-------------------------
| CAT A | CAT A | CAT A |
-------------------------
| CAT B |
-------------------------
| CAT A | CAT A | CAT A |
-------------------------
| CAT B |
-------------------------
| CAT A | CAT A | CAT A |
-------------------------
| CAT B |
Basically there are two loops, one inside each other, running in parallel and individually.
I can get the number of current post of the main loop by $wp_query->current_post
and insert a new WP_Query
after each third post with only one post (by posts_per_page=>1
) and offset by the number of previous posts (by offset=>$wp_query->current_post
).
I'm afraid this is a very memory intensive thing to call a new WP_query after each third post. Are there any better alternatives to display posts in the markup I specified above? Many thanks.