1
wordpress plugin repeater를 사용하고 있습니다. 이 경우에는 LI에서 시작하여 각각의 하위 필드 게시물에 자체 아이템 카운터를 갖게하고 싶습니다.sub_fields가있는 게시물 수에 대한 표시 클래스
첫 번째 항목에는 1의 클래스가 있고 두 번째 항목에는 2의 클래스가있는 식으로됩니다.
<?php while(has_sub_field('home_panels')): ?>
<li class="item" data-factor="1">
<a href="<?php the_sub_field('panel_link'); ?>">
<img src="<?php the_sub_field('panel_image'); ?>" />
<div class="caption">
<div>
<div>
<h3><?php the_sub_field('panel_title'); ?></h3>
<span class="excerpt"><?php the_sub_field('panel_description'); ?></span>
</div>
</div>
</div>
</a>
</li>
<?php endwhile; ?>