Support

Account

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/