我实际上需要在我的单个博客页面上检索关系的高级自定义字段。
这是我的查询:
<?php
$ingredients = get_field('ingredients');
if ($ingredients) {
echo '<ul>';
foreach($ingredients as $ingredient) { ?>
<li><?php echo get_the_title($ingredient); ?>
</li>
<? }
echo '</ul>';
}
?>
我需要的ACF被命名为“quantite”。 我尝试了很多东西:
<?php
$ingredients = get_field('ingredients');
if ($ingredients) {
echo '<ul>';
foreach($ingredients as $ingredient) { ?>
<li><?php echo get_the_title($ingredient);
echo get_field('quantite'); / echo the_field('quantite');
echo get_field($ingredient, 'quantite'); /
echo the_field($ingredient, 'quantite');?>
</li>
<?php}
echo '</ul>';
}
?>
没有任何效果。我尝试使用和不使用“回声”。
你有什么想法吗?
编辑:更具体地说,除了 ACF 之外,一切正常。例如 get_the_title($ingredient) 正在工作。我也尝试了缩略图,它有效。但与ACF无关。 谢谢