delarge
2/14/2015 - 9:30 PM

Query posts based on date. This example shows how you can use the WP_Query object to find posts where a ‘start_date’ and ‘end_date’ indicate

Query posts based on date. This example shows how you can use the WP_Query object to find posts where a ‘start_date’ and ‘end_date’ indicate that the post is ‘active’ (today is between the start and end dates). Edit accordingly. http://www.advancedcustomfields.com/resources/date-picker/

<?php
$today = date('Ymd');

$args = array (
    'post_type' => 'post',
    'meta_query' => array(
		array(
	        'key'		=> 'start_date',
	        'compare'	=> '<=',
	        'value'		=> $today,
	    ),
	     array(
	        'key'		=> 'end_date',
	        'compare'	=> '>=',
	        'value'		=> $today,
	    )
    ),
);

?>