我对作者使用相同的模板。php和主页/博客。php。
我把一个环分成三部分。
<?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;
?>
这在主页/博客页面上似乎很好,但对作者来说却很好。php,在第二个while循环中,我从1开始收到帖子,而我不应该收到任何帖子。对于这位特殊的作者,我有两篇帖子,因此我应该得到如下信息:
<?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;
?>
但我得到的是:<?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;
?>
我的线圈怎么了?