Home › Forums › General Issues › Only show my posts if the date picker date is still in the future or today › Reply To: Only show my posts if the date picker date is still in the future or today
I tried this below but it seems it only compares the day and not the rest of the date. If the day is a smaller number than today’s day, it does not display it..
<?php $loop = new WP_Query( array( 'post_type' => 'evenement', 'posts_per_page' => 10 ) ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<?php
$today = date("d/m/y");
$date_event = date(get_field('start_event'));
?>
<?php if (get_field('start_event') >= $today) { ?>
<a href="<?php echo get_permalink() ?>">
<div class="image">
<?php echo the_post_thumbnail(); ?>
</div>
<div class="description">
<div class="dates">
<?php echo get_field('start_event') ?> à <?php echo get_field('hour_start_event') ?>
</div>
<div class="nom">
<?php echo the_title(); ?>
</div>
</div>
</a>
<?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.