I need to create blocks of posts in my theme. So far, I only thought of one possible implementation - a nested loop:
The Code
for ($i = 0; have_posts(); $i++) {
for ($j = 0; have_posts() && $j < 100; $j++) {
the_post();
echo "<p>$i, $j</p>";
}
}
The Problem
Alas, this code generates an endless loop. have_posts()
returns true
in the loop on the outside every time.
What I tried
Using the_content()
in the outside loop. It doesn't solve the problem and makes the inside loop iterate one time less. THat's the only thing I thought of.