【发布时间】:2015-12-28 11:42:28
【问题描述】:
我正在使用高级自定义字段,并且在转发器中有转发器。我需要嵌套中继器随机拉一排。这是我所拥有的不起作用的:
<?php $i = 0; while(the_repeater_field('squares')): ++$i;
$repeater = get_sub_field( 'images' );
$rand = rand(0, (count($repeater) - 1));?>
<a href="<?php the_sub_field('link'); ?>" class="fs-square" style="background-image:url('<?php echo $rand['four-square']; ?>')">
<div class="main-text"><?php the_sub_field('main_text'); ?></div>
<div class="icon-section">
<div class="icon"><?php the_sub_field('icon'); ?></div>
<div class="icon-text"><?php the_sub_field('icon_text'); ?></div>
</div>
</a>
<?php endwhile; ?>
基本上,我有一个正方形中继器,然后我有一个图像中继器。我需要图像中继器是随机的。
【问题讨论】:
标签: wordpress advanced-custom-fields