I can't figure out how to compare timestamps in the WP_query. On the site, classes/events are entered as posts with meta added for the date they begin. In 'calendar_functions.php', $begtime is defined as the timestamp for the date the class/event starts (not the date the post is created) and $today is defined as today's timestamp. I've tested both of those and they do return correct values.
The below code works fine, it displays a random class/event... except that past classes/events show up. I want to be able to only display items that happen from today on. Its not an option to go in and delete classes/events that have already happened.
<?php include('calendar_functions.php'); ?> <?php $my_query = new WP_Query('"$begtime >= $today"&posts_per_page=1&cat=5,43&orderby=rand'); if (have_posts()) : while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID; ?>
I will also need to be able to compare two sets of dates, as some classes have two sessions, ex. "$begtime >= $today -or- $begtime2 >= $today". ($begtime2 is also already defined).