Home › Forums › Front-end Issues › query by date › Reply To: query by date
Hi Elliot
Thanks first for the outstanding support.
I’m going to check that out soon and let you know.
For the meantime i got a workaround with an if statement. That might not be the most beautiful solution, but it works temporarely:
`<?php $args = new WP_Query(
array(
‘post_type’ => ‘chuchi_event’,
‘meta_key’ => ‘event_datum’,
‘orderby’ => ‘meta_value’,
‘order’ => ‘dsc’,
‘posts_per_page’ => 50,
)); ?>
<?php while($args->have_posts()) : $args->the_post(); ?>
<?php
$datex = strtotime(date_format(date_create(”.get_field(‘event_datum’).”),’d-m-Y’));
$now = time();
?>
<?php
if($now <= ($datex+(60*60*24))){
?>
<div>
</div>
<?php
}
?>
<?php endwhile; ?>
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.