基本上是我的单曲。php文件中,我直接将当前帖子查询到模板中,同时还有一个相关帖子部分。
问题是,当ACF尝试检索相关post查询循环中的post字段时,它会检索当前显示的post。
while(have_posts()){ the_post();
echo the_field(\'field1\');
echo the_field(\'field2\');
echo the_field(\'field3\');
}
$recent_posts = wp_get_recent_posts();
foreach( $recent_posts as $recent ){ ?>
<img src="<?php echo the_field(\'field1\')?>">
<?php
echo the_title();
}
因此本质上它从当前post而不是最近的\\u posts查询中获取field1。我对这个问题一直很困惑。循环和查询不在while循环的范围内,所以应该可以吧?