使用 Timber 从关系字段获取 ACF

Get ACF from relationship field with Timber

我在自定义 post 类型上使用高级自定义字段。在主页上,我有一个与 select 自定义 post 类型中的 post 之一的关系字段。

使用 Timber,我正在努力将该关系 post 的 ACF 字段放入上下文中。我可以获得标准的 wordpress 信息,例如标题和内容,但不能获取 ACF。

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

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

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

所以我试过了,但我哪里出错了:

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

感谢任何帮助,谢谢

已排序,所以 php 是正确的:

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

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