【发布时间】:2020-07-21 21:23:00
【问题描述】:
我正在使用 ACF 在我的 Wordpress 模板文件的表格中显示一个重复字段。字段正在显示 - 但是该表似乎为每一行创建一个新的“表”,而不是在同一个表中包含两行子字段数据。
这是我的代码:
<?php if(get_field('monthly_expenses')): ?>
<ul>
<?php while(has_sub_field('monthly_expenses')): ?>
<table>
<tbody>
<tr>
<td><strong> Monthly Expense</strong></td>
<td><strong>Estimated Amount</strong></td>
<td><strong>Registered Supplier</strong></td>
</tr>
<tr>
<td><?php the_sub_field('monthly_expense'); ?></td>
<td><?php the_sub_field('estimated_amount'); ?></td>
<td><?php the_sub_field('registered_supplier'); ?></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
<!-- DivTable.com -->
<?php endwhile; ?>
</ul>
【问题讨论】:
标签: wordpress html-table advanced-custom-fields repeater