Hi

Background:
I have a custom post type called eventitem which I use to create a list of events.

Each eventitem has a title, content and a custom field called date_of_event, which is a string of the format 'yyyymmdd' e.g.: 20120924

The problem:
I have an events list which pulls all these out and uses the Wordpress 'loop' to iterate over them in date_of_event order (rather than the post date). This works fine

However, on the site's homepage I also need to show the next upcoming event title and date, i.e.: the next 1 post where date_of_event >= today's date, but can't for the life of me work out how to dip into a loop and check the record's custom field against today's date

I have this code as a starting point, based on the code that works in my 'event list' page (described above) but obviously that's not pulling back the next event using date_of_event, it's pulling back the most recent post based on post date...

PHP Code:
<!-- start latest event -->
<?php $my_query = new WP_Query('post_type=eventitem&posts_per_page=1&orderby=meta_value&meta_key=date_of_event&order=DESC'); ?>
<?php 
while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <?php $do_not_duplicate $post->ID?>
    <?php $datearray date_parse(get_post_meta($post->ID"date_of_event"true)); ?>
    <p>
        <?php echo date('l jS M Y'strtotime($datearray['day'] ."-"$datearray['month'] ."-"$datearray['year'])); ?><br/>
        <strong><?php the_title(); ?></strong>
    </p>
    <?php endwhile; ?>
<!-- end latest event -->
Any ideas what that query should be so it only returns the next event, using the date_of_event custom field?



(Hope all that makes sense. Thanks in advance!)