Home › Forums › Front-end Issues › Custom fields only displaying for one post › Reply To: Custom fields only displaying for one post
Hi @raindahl
I believe you added it to the functions.php file. Because the get_field() function was called outside The Loop, you need to get the post object using the global method. Could you please try the following code?
global $post;
$music = get_field( 'music', $post->ID );
$video = get_field( 'video', $post->ID );
$set_list = get_field( 'set_list', $post->ID );
$photos = get_field( 'photos', $post->ID );
Thanks!
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.