Home › Forums › General Issues › Loop issue with checkbox › Reply To: Loop issue with checkbox
Ok, so you want to only display the latest featured post, right?
You need to specify everything in the WP_Query – there’s no need for additional checking, if you only want one post. Use the meta_query, like this:
$args = array (
'post_type' => 'nieuws',
'posts_per_page' => 1,
'orderby' => 'date',
'order' => 'DESC',
'meta_query' => array(
array(
'key' => 'published',
'compare' => '=',
'value' => 1
)
),
);
You can find more examples of such queries here: http://www.advancedcustomfields.com/resources/how-to/how-to-query-posts-filtered-by-custom-field-values/
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.