Home › Forums › General Issues › Output Custom Fields Relational Post Object Field › Reply To: Output Custom Fields Relational Post Object Field
If you are going to loop over the posts as in the code above then you do not need setup_postdata() because you’re using $featured_post->ID
This is for getting a field for the post of the related post, not the current post.
$custom_field = get_field( 'field_name', $featured_post->ID );
To add text above of below you can just add it inside of the if block.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.