Support

Account

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; ?>