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
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.