Get ACF from relationship field with Timber

admin

Administrator
Staff member
I'm using Advanced Custom Fields on a custom post type. On the homepage I have a relationship field to select one of the posts in the custom post type.

Using Timber, I'm struggling to get the ACF fields for that relationship post into the Context. I can get the standard wordpress info like title and content, but not the ACFs.

I think I need to use TimberPost, but haven't had any success so far.

This is in my page template. In the view it just outputs all the standard WP stuff:

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

So I tried this, but I'm going wrong somewhere:

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

Appreciate any help, thanks