我需要从今天开始对即将发生的事件进行排序,然后从今天开始对过去的事件进行排序。这是我到目前为止所拥有的,但我不确定如何设置元键以使其成为日期排序工作(或者元值可能是错误的?)。日期、月份和年份值是分开的,所以我需要以某种方式将它们组合起来..?现在我按字母顺序排列月份,因为这是我唯一可以开始工作的事情。:) 哈哈
<?php if(have_posts()) : ?>
<?php while(have_posts()) : the_post(); ?>
<?php
$eventquery = array (
'post_type' => 'events',
'orderby' => 'meta_value',
'order' => 'asc',
'posts_per_page' => 10,
'meta_value' => strftime("%Y/%m/%d", time()- (60 * 60 * 24) ),
'meta_key' => '_cmb_e_month',
'meta_compare' => '>',
);
?>
<?php $myeventlist = new WP_Query($eventquery); ?>
<?php while ($myeventlist->have_posts()) : $myeventlist->the_post();
$m_date = get_post_meta( $post->ID, '_cmb_e_date', true );
$m_month = get_post_meta( $post->ID, '_cmb_e_month', true );
$m_day = get_post_meta( $post->ID, '_cmb_e_day', true );
$m_year = get_post_meta( $post->ID, '_cmb_e_year', true );
$m_start_time = get_post_meta( $post->ID, '_cmb_e_start_time', true );
$m_end_time = get_post_meta( $post->ID, '_cmb_e_end_time', true );
$m_venue = get_post_meta( $post->ID, '_cmb_e_venue', true );
$event_text = get_post_meta($post->ID, "_cmb_e_details", true);
$event_price = get_post_meta( $post->ID, '_cmb_e_price', true );
$event_ticket_status = get_post_meta( $post->ID, '_cmb_e_ticket_status', true );
$event_thumb = the_post_thumbnail('thumbnail');
?>