I have set up a Custom Post Type called "Events". I set the event date in a Custom Field called "date__time." What I'd like to do, is on my Events landing page, display only those events that are in the future based on the date entered in the Custom Field.
After digging around, here's what I've come up with:
<?php $events = new WP_Query( 'post_type=events&posts_per_page=-1&meta_key=date__time&orderby=meta_value&meta_compare=>=&meta_value='.time().'&order=ASC' ); if ($events->have_posts()) : while ($events->have_posts()) : $events->the_post(); ?>
I have set up two events, one in the past and one in the future. The problem is, both events are showing.
I have read something about storing the value of the Custom Field (date__time - in the above code) as a unix time stamp, but I have no idea how to do that or why (or where to do that).
Any help would be greatly appreciated.