0
我有一个显示HTML的while
循环。更改while循环中的第一个元素?
但是,我只需要第一次迭代的不同元素。
我该如何管理?这是我的代码:
<?php
if (have_posts()) :
while (have_posts()) :
the_post();
$image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'single-post-thumbnail');
?>
<div class="item" style="background-size:cover; background-image: url(<?php echo $image[0]; ?>); width: 100%; min-height: 300px;">
<div class="carousel-caption">
<h3><?php the_title(); ?></h3>
<p><?php comments_number('Pas de commentaires', '1 commentaire', '% commentaires'); ?></p>
</div>
</div>
<?php
endwhile;
endif;
?>
感谢您的帮助!