I have a custom post type of events. I want to display the event only if its today or upcoming.
The problem i'm having is if I have multiple events, the order isnt going according to the date.
I did try echoing the timestamp and it was off - it needs to be converted to php timestamp - is there a way to divide the timestamp by 1000 in jquery before it saves it? or am I totally off here
any help would be greatly appreciated!
Custom field
<input type="text" class="datepicker" size="30" />
<input type="hidden" id="event_date" size="30" />
datepicker js
jQuery(document).ready(function(){
jQuery('.datepicker').datepicker({
dateFormat : 'DD, MM dd',
altField: "#event_date",
altFormat: '@'
});
});
Callback php
<?php $classarg = array('post_type' => 'class', 'meta_query' => array(array('key' => 'event_date', 'value' => time(), 'compare' => '>=',),),'orderby'=> 'key', 'posts_per_page'=> '-1', 'order'=>'ASC');
$classes = new WP_Query($classarg ); if ( $classes->have_posts() ) {while ( $classes->have_posts() ) { $classes->the_post();?>
<h2><?php the_title();?></h2>
<?php the_content();?>
<?php }} wp_reset_postdata();?>