Support

Account

Home Forums General Issues loop with post based on date picker Reply To: loop with post based on date picker

  • this code did the trick

    <?php $today = date("Ymd");?>
    <?php $loop = new WP_Query( array(
    'post_type' => 'reports',
    'posts_per_page' => 5,
    'meta_key' => 'date',
    'meta_compare' => '>=',
    'meta_value' => $today,
    'orderby' => 'meta_value_num',
    'order' => 'ASC'
    ) );	?>
    
    <?php while ($loop->have_posts()) : $loop->the_post(); ?>
    // do stuff
    <?php endwhile; ?>