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:
$context['featureRelationship'] = get_field('feature');
So I tried this, but I'm going wrong somewhere:
$context['featureRelationship'] = new TimberPost(get_field('feature'));
Appreciate any help, thanks
Sorted, so the php was right:
$context['featureRelationship'] = new TimberPost(get_field('feature'));
But I should have used a post object acf field instead of relationship
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.