【发布时间】:2021-11-16 15:00:14
【问题描述】:
我必须在我之前用 acf 创建的表中显示相应的字段。我使用页面 ID 作为指南。第一个页面有效,附加 id 未加载为“tr”。
有人知道我做错了什么吗?
elseif ( is_page(59) && have_posts() ) : // Produktübersicht
echo '<div class="container produktuebersicht">';
while ( have_posts() ) : the_post();
echo '<div class="row">
<div class="col-md-12">
<div class="inner">';
$parent = $post->post_parent;
$currentpage = $post->ID;
the_content();
echo '<ul class="submenu">';
wp_list_pages( array(
'depth' => 2,
'child_of' => $parent,
'exclude' => '44, 46, 48, 50, 52, 54, 57, 59',
'link_before' => '',
'title_li' => '',
'sort_column' => 'menu_order'
) );
echo '</ul> ';
wp_reset_postdata();
?>
<?php if(have_rows('attribute', '149', '151')): ?>
<table class="produkttabelle">
<thead>
<tr>
<th>Produktname</th>
<th>Wirkstoff</th>
<th>Darreichungsform</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php while( have_rows('attribute', '149', '151')) : the_row(); ?>
<tr>
<td><?=$produktname = get_sub_field('produktname');?></td>
<td><?=$wirkstoff = get_sub_field('wirkstoff');?></td>
<td><?=$darreichungsform = get_sub_field('darreichungsform');?></td>
<td><?=$status = get_sub_field('status');?></td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
<?php endif;
echo '</div>
</div>
</div>'; ?>
<?php endwhile;
【问题讨论】:
-
欢迎来到 StackOverflow,尽可能准确地描述您的问题很重要。为了提高您获得答案的机会,您应该阅读How do I ask a good question?
标签: php html wordpress html-table advanced-custom-fields