我用四个子字段包装了一个Repeater字段,如何在html中编写代码
对于exp,这是一个HTML代码
<ul>
<li class="first">
<a href="service_detail.html">
<div class="img-blk"><img src="images/fencing1.png" class="nor" alt="" /><img src="images/fencing1h.png" class="hov" alt="" /></div>
<h3>Fencing</h3>
</a>
</li>
<li>
<a href="service_detail.html">
<div class="img-blk"><img src="images/slashing1.png" class="nor" alt="" /><img src="images/slashing1h.png" class="hov" alt="" /></div>
<h3>Slashing</h3>
</a>
</li>
<li>
<a href="service_detail.html">
<div class="img-blk"><img src="images/earth1.png" class="nor" alt="" /><img src="images/earth1h.png" class="hov" alt="" /></div>
<h3>Earthwork</h3>
</a>
</li>
<li>
<a href="service_detail.html">
<div class="img-blk"><img src="images/exca1.png" class="nor" alt="" /><img src="images/exca1h.png" class="hov" alt="" /></div>
<h3>Excavation</h3>
</a>
</li>
<li class="last">
<a href="service_detail.html">
<div class="img-blk"><img src="images/equip1.png" class="nor" alt="" /><img src="images/equip1h.png" class="hov" alt="" /></div>
<h3>Equipment</h3>
</a>
</li>
</ul>
最合适的回答,由SO网友:Marcos Rodrigues 整理而成
在这里你会找到你需要知道的一切。
http://www.advancedcustomfields.com/resources/field-types/repeater/
一个例子
<?php if(get_field(\'repeater_field_name\')): ?>
<ul>
<?php while(has_sub_field(\'repeater_field_name\')): ?>
<li>sub_field_1 = <?php the_sub_field(\'sub_field_1\'); ?>, sub_field_2 = <?php the_sub_field(\'sub_field_2\'); ?>, etc</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>