Support

Account

Home Forums General Issues Querying Multiple Post Types Reply To: Querying Multiple Post Types

  • Hi @kevinreilly

    As long as your date field is saved with the default format (JS format = yymmdd), then you can compare the values like so:

    
    <?php 
    
    $today = date('Ymd');
    
    $args = array (
        'post_type' => array('friday','saturday','sunday','special'),
        'meta_query' => array(
    		array(
    		    'key' 	=> 'publish_area',
    		    'value'	=> 'left',
    		),
    		array(
    	        'key'		=> 'start_date',
    	        'compare'	=> '<=',
    	        'value'		=> $today,
    	    ),
    	     array(
    	        'key'		=> 'end_date',
    	        'compare'	=> '>=',
    	        'value'		=> $today,
    	    )
        ),
    );
    
    ?>
    

    Please note this code is untested, but should explain how to do it!

    Thanks
    E