i only want to show upcoming events posts on the homepage. i have made a custom field using the 'custom field suite' plugin, called 'ENDS' representing the date an event ends.
as you can tell, i simply want upcoming events on the home, with the nearest to present date being first in line. upon expiring, i want it filed in the 'archive', which is visible on another page (which should also order archived event posts beginning with most recently expired event).
the template uses infinite scroll to load posts, and this is my index file, with the default loop: http://pastebin.com/x3NzZBZX
i need to integrate something like this, but have had no success:
<?php
$query = new WP_Query(
'post_type' => 'post',
'orderby' => 'meta_value',
'meta_key' => 'ENDS',
'order' => 'ASC',
'posts_per_page' => -1,
'meta_query' => array(
'key' => 'ENDS',
'value' => date('Y-m-d H:i:s'), // now
'compare' => '>='
),
);
?>
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
<a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
</a>
<?php endwhile; ?>