I am using the same template for author.php and home/blog.php.
I have a loop split into 3 parts.
<?php
if(have_posts()): the_post;
//do a thing
endif:
$i = 0;
while(have_posts()): the_post();
//do three things
$i++; if ($i == 3): break; endif;
endwhile;
while(have_posts()): the_post();
//do the rest
endwhile;
?>
This seems to be working fine on the home/blog page but on the author.php, in the 2nd while loop, I'm getting posts starting from 1, when I shouldn't be getting any.
For this particular author I have 2 posts so I should be getting something like:
<?php
if(have_posts()): the_post();
//post1
endif:
$i = 0;
while(have_posts()): the_post();
//post2
$i++; if ($i == 3): break; endif;
endwhile;
while(have_posts()): the_post();
//no posts
endwhile;
?>
But instead I'm getting:
<?php
if(have_posts()): the_post();
//post1
endif:
$i = 0;
while(have_posts()): the_post();
//post2
$i++; if ($i == 3): break; endif;
endwhile;
while(have_posts()): the_post();
//post1 + post2
endwhile;
?>
What's up with my loops?