I've done some research and found separate solutions for ordering custom posts by custom field value and excluding posts by date. But I cannot figure out how to do both: have tried various ways of stringing different solutions together.
I'm trying to show events that are ordered by a custom field (order-date) that is in Y-m-d format. That part works until I add the code meant to filter out past dates ('meta_value' >= $today). Once that's added, it displays unfiltered blog posts, rather than "performance" custom posts.
Here is the code I'm currently using:
<?php $today = date('Y-m-d'); $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1; query_posts((array('post_type' => 'performance', 'posts_per_page' => 5, 'caller_get_posts' => 5, 'paged' => $paged, 'meta_key' => 'order-date', 'orderby' => 'meta_value', 'order' => 'ASC' )) && ('meta_value' >= $today)); if (have_posts()) : while (have_posts()) : the_post(); ?>
Obviously, the code meant to filter out past events is not working. How can I filter past events using the "order-date" custom field?