我使用推特引导旋转木马从特定类别中获取帖子。我一直在研究双循环,但我不知道如何实现它。
这是我的循环:
$query = array( \'posts_per_page\' => 4, \'cat\' => 3);
$queryObject = new WP_Query($query);
$count = 0;
if($queryObject):
while($queryObject->have_posts() ) : $queryObject->the_post();
$count++;
它从第3类中吸引了4个帖子(我现在已经有了)<div class="item <?php if($count === 1){
echo " active";
}elseif($count >=4){
echo " ";
} ?>">
<div class="span4">
<?php the_content();?>
</div><!--end of span4-->
</div>
我要做的是重复div元素<div class="span4">
, 基本上是这样的this. 最初,我用上面的if-else语句<div class="item">
让班级活跃在前三个岗位和第四个岗位上,什么都没有。这样它就不旋转了,所以我正在尝试这个选项。<div class="item active">
<div class="span4"><?php the content();?></div>
<div class="span4"><?php the content();?></div>
<div class="span4"><?php the content();?></div>
编辑:由于某种原因,我的代码被删除了。
我尝试过使用双循环功能,但它也不能像我想要的那样工作,也许我的逻辑是关闭的,但使用双循环时,有一个偏移量,我不想要。任何建议都很好。
谢谢