I've set up an Events page using an 'Events' custom post type. I've found code on the net in order to display future events set by a custom field value. However it isn't working correctly. For some reason one of the events set for the date 02/01/2012 only shows up when I use a < compare statement, even though today's date is 16/12/2012.
The code I'm using is this:
<?php $today = date('d-m-Y'); query_posts(array( 'post_type' => 'shows', 'posts_per_page' => 25, 'meta_key' => 'order-date', 'orderby' => 'meta_value', 'order' => 'ASC', //descending order 'meta_query' => array( array( 'key' => 'order-date', 'meta-value' => $value, 'value' => $today, 'compare' => '>=', //show events greater than or equal to today 'type' => 'CHAR' ) ) )); if (have_posts()) : while (have_posts()) : the_post(); ?>
With 2 events added, each with a order-date custom field values of 02/01/2012 and 27/01/2012 respectively. The first only appears when I change the '>=' to '<' when they both should appear when using the '>='.
Can anyone point me in the direction of why this is going wrong please? All tutorials I've seen have similar code to what I've used above. It's got nothing to do with the fact that the site is a local testing version installed using MAMP is it?