Home › Forums › Front-end Issues › True/False Not Working after adding post › Reply To: True/False Not Working after adding post
Hi @Yashi
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:
http://www.advancedcustomfields.com/resources/how-to/how-to-query-posts-filtered-by-custom-field-values/
To sum up, you want to query posts that have the custom field value, then remove the if statement completely
Thanks
E
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.