从与Timber的关系字段中获取ACF


Get ACF from relationship field with Timber

我在自定义帖子类型上使用高级自定义字段。在主页上,我有一个关系字段,用于选择自定义帖子类型中的一个帖子。

使用Timber,我正在努力将该关系帖子的ACF字段放入上下文中。我可以得到标准的wordpress信息,如标题和内容,但不是ACFs。

我想我需要使用TimberPost,但到目前为止还没有任何成功。

这是在我的页面模板。在视图中,它只输出所有标准WP内容:

$context['featureRelationship'] = get_field('feature');

所以我尝试了这个,但是我在某处出错了:

$context['featureRelationship'] = new TimberPost(get_field('feature'));

感谢任何帮助,谢谢

排序,所以php是正确的:

$context['featureRelationship'] = new TimberPost(get_field('feature'));

但是我应该使用post对象acf字段而不是relationship