Home › Forums › Front-end Issues › content in custom fields not showing on live page › Reply To: content in custom fields not showing on live page
I can’t say for certain if this is the issue but you have an outer loop which is the main loop and holds the Global $post object. You then have an inner loop with a foreach()
. Whenever you call the_field()
it will always pull from the Global $post object unless told otherwise. Your foreach()
doesn’t overwrite this ( you would need to use setup_postdata( $slide )
).
The solution could be, assuming you want to pull field values from the get_posts()
results is to pass the post or post ID into the function call like so:
the_field( 'main_slide_title', $slide )
or
the_field( 'main_slide_title', $slide->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.