1
これは私のコードであり、ループ内の2番目の子にクラスを追加したいと思います。どうすればいいのか教えてください。私はワードプレスで新しいです。どのようにワードプレスループ内の特定の子にクラスを追加する
<?php
$args = array(
'posts_per_page' => 3,
'post_type' => 'hosting_plan',
'order' => 'ASC'
);
query_posts($args);
if (have_posts()) : while (have_posts()) : the_post();
?>
<div class="hostplbx /*here i want to add class on second child*/">
<h3><?php the_field('plan_name'); ?></h3>
<div class="hostprice">
<span class="hosprice"><b class="rs"><?php the_field('plan_price'); ?></b> per month</span>
<span class="plandetail"><?php the_field('tag_line'); ?></span>
</div>
<?php the_content(); ?>
</div>
<?php endwhile; ?>
<?php endif; ?>