i'm using this to pull in my 'events' custom post type
WP_Query('post_type=events&posts_per_page=10&meta_key=Date&orderby=meta_value&order=ASC&')
but I want to add a WHERE clause so it only brings in dates that are in the future
i've managed to kinda do it with this, but this only works in the 'loop'
<?php $recent = new WP_Query('post_type=events&posts_per_page=10&meta_key=Date&orderby=meta_value&order=ASC');
if ($recent->have_posts()) :
while($recent->have_posts()) : $recent->the_post();
$fakedate = get_post_meta($post->ID, 'Date', true);
list($y, $m, $d) = explode('/', $fakedate);
$makedate = mktime(0, 0, 0, $m, $d, $y);
$eventdate = strftime('%d %b %Y',$makedate);
$checkdate = strftime('%Y%m%d ',$makedate);
$todaysdate = date('Ymd');
if ($checkdate >= $todaysdate) : ?>
<a title="<?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php echo $eventdate; ?> - <?php the_title(); ?></a>
<?php endif; ?>
<?php endwhile; ?>
<?php else : ?>
<p>There are currently no events to display</p>
<?php endif; ?>