Home › Forums › Front-end Issues › Displaying a group outside WordPress Loop › Reply To: Displaying a group outside WordPress Loop
Hi @jazibzaman
The the_field() function needs the post ID for the second parameter if you call it outside of The Loop. So, it should be something like this:
<span class="aps-1co"> <?php the_field('device_type', $post_ID); ?> </span>
Also, you only need the PHP closing tag after a PHP code. So, in your case, I believe you don’t need it.
I hope this helps 🙂
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.