入力したACFリピータフィールドのすべてのペアの周りにdivを追加する必要があります。 私は、3つのフィールドごとに仕事をするコードスニペットを持っています。番号を変更するたびに、次のdiv IDが前の子IDになります。 どのような提案も素晴らしいでしょう!ありがとう2つのリピータフィールドごとにdivを追加するACF
// check if the repeater field has rows of data
if(have_rows('services')):
// loop through the rows of data
// add a counter
$count = 0;
$group = 0;
while (have_rows('services')) : the_row();
// vars
$teacher_bio = get_sub_field('service_title');
$teacher_name = get_sub_field('service_information');
$teacher_image = get_sub_field('icon');
if ($count % 3 == 0) {
$group++;
?>
<div id="services-<?php echo $group; ?>" class="cf group-<?php echo $group; ?>">
<?php
}
?>
<div class="service">
<img src="<?php the_sub_field('icon'); ?>" />
<p><?php echo $teacher_name; ?></p>
<?php echo $teacher_bio; ?>
</div><!-- .teacher -->
<?php
if ($count % 3 == 2) {
?>
</div><!-- #services -->
<?php
}
$count++;
endwhile;
else :
// no rows found
endif;
が、これは簡単なことではありませんが、あなたは自分のリピータ内部リピーターがあったら?それぞれの "教師/サービス"の行があり、あなたが望む任意のhtmlでそれをラップすることができます – Stender