我有一个查询,如下所示:
<?php
$query = new WP_Query( $wpplnum );
while( $query->have_posts() ): $query->the_post();
?>
<div class="carousel-item col-md-4 active">
<div class="card">
<img class="card-img-top img-fluid" src="http://placehold.it/800x600/f44242/fff" alt="Card image cap">
<div class="card-body">
<h4 class="card-title">Card 1</h4>
<p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
<p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
</div>
</div>
</div>
我想添加
active
仅对第一个循环项初始化:
class="carousel-item col-md-4 active"
其余循环项将不包含
active
类别:
class="carousel-item col-md-4"