【发布时间】:2019-11-10 20:43:18
【问题描述】:
我想打印 ACF 转发器行中的行数。我有一个 foreach 循环设置,但我不知道我缺少什么。
<?php if( have_rows('repeater_section') ): ?>
<ul>
<?php while( have_rows('repeater_section') ): the_row(); ?>
<li>
$items = get_field('items', 'option');
<?php
foreach ($items as item) {
if (i=0; i<=items.length)
?>
<p>Items: <?php $i;?></p>
<?php
}
?>
</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
如果 ACF 字段中有 3 行数据,则输出示例。
Items: 1
Items: 2
Items: 3
【问题讨论】: