我正在尝试在表格中输出acf 5
repeater field。
我使用以下代码:
<?php
// check if the repeater field has rows of data
if (have_rows('founder')):
?>
<div class="control-group">
<label class="control-label">Founders</label>
<div class="controls">
<table class="table table-hover">
<thead>
<tr>
<th>Image</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<?php
// loop through the rows of data
while (have_rows('founder')):
the_row(); ?>
<tr>
<td> <img src="<?php the_sub_field('founder_img'); ?>"></img> </td>
<td><?php echo get_sub_field('firstname'); ?> <?php the_sub_field('lastname'); ?></td>
</tr>
<?php
endwhile; ?>
</tbody>
</table>
</div>
</div>
<?php endif; ?>
然而,即使我在后端填写了所有字段,我也得到以下输出:
html输出如下所示:
<div class="control-group">
<label class="control-label">Founders</label>
<div class="controls">
<table class="table table-hover">
<thead>
<tr>
<th>Image</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<tr>
<td> <img src="https://example.com/wp-content/uploads/2016/03/no-avai.jpg"> </td>
<td>test test</td>
</tr>
<tr>
<td> <img src="https://example.com/wp-content/uploads/2016/03/no-avai.jpg"> </td>
<td>Firstname Lastname</td>
</tr>
</tbody>
</table>
</div>
</div>
我有什么建议吗?