Home › Forums › Front-end Issues › True/False Not Working after adding post › Reply To: True/False Not Working after adding post
There is a logic error in your code. You are loading 5 posts, but then within the loop you are checking for the value of ‘featured_news’.
If none of the 5 latest posts have this selected, then no HTML will be rendered.
What you indented to do was to query the posts with the a ‘featured_news’ value of 1. You can do this by following the tutorial here:
To sum up, you want to query posts that have the custom field value, then remove the if statement completely
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’re reaching out to our multilingual users to ask for help in translating ACF 6.1. Help make sure the latest features are available in your language here: https://t.co/TkEc2Exd6U— Advanced Custom Fields (@wp_acf) May 22, 2023
© 2023 Advanced Custom Fields.