Home › Forums › Front-end Issues › Image wont display in header.php template file › Reply To: Image wont display in header.php template file
Since you are in header.php you are outside of “The Loop”, you will need to supply the get_field() function with the post ID;
$queried_object = get_queried_object();
$image = get_field('background_image', $queried_object->ID);
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.