Wordpress All-in-One Event Calendar: Show Upcoming Events Only

I use the all-in-one event calendar, which can be found here: http://wordpress.org/extend/plugins/all-in-one-event-calendar/
I'm trying to display only upcoming events (so no past events) using the WP_Query () function. I see that the database has a table "wp_ai1ec_events" and a column named "start" with the start time in the format yyyy-mm-dd hh: mm: ss. I can get the current time in the same format using $ currentTime = current_time ('mysql')

This is what my query looks like:

    $frontpageevents='post_type=ai1ec_event&showposts=3&orderby=start&order=ASC&meta_value=yes';
$eventquery = new WP_Query($frontpageevents);

I tried adding '& start>'. $ currentTime until the end of the $ frontpageevents declaration, but this did not work. I was hoping someone knew how to handle this.

+5
source share
2 answers

http://wordpress.org/support/topic/plugin-all-in-one-event-calendar-order-event-by-start-date?replies=3#post-2443756

I am looking for something like that. I found the above post which should help!

" - , / != . , , . , API- . - get_events_between(). Ai1ec_Calendar_Helper. : app/helper/class-ai1ec-calendar-helper.php . 't , , : http://pastebin.com/SNp4TJij"

!

, ... , ​​ .


    global $ai1ec_calendar_helper, $ai1ec_events_helper;

    // gets localized time
    $bits = $ai1ec_events_helper->gmgetdate( $ai1ec_events_helper->gmt_to_local( time() ) );

    //sets start time to today
    $start = gmmktime(0,0,0,$bits['mon'],$bits['mday'],$bits['year']);

    //sets end time to a year from today i.e. $bits['year']+1
    $end = gmmktime(0,0,0,$bits['mon'],$bits['mday'],$bits['year']+1);

    //Look in class-ai1ec-calendar-helper.php for details
    $get_events = $ai1ec_calendar_helper->get_events_between($start,$end);

    //loop through results to get post_ids
    foreach($get_events as $event ):
        $post_ids[] = $event->post_id;
    endforeach;

    // The New Events Query
    $args = array(
        'posts_per_page'  => 4,
        'paged' => get_query_var('paged'),
        'post_type'=> 'ai1ec_event',
        'post__in' => $post_ids
    );

    $events_added = new WP_Query( $args );

    // The Loop
    while ( $events_added->have_posts() ) : $events_added->the_post();
        $event = Ai1ec_Events_Helper::get_event($post->ID);
        //Your code here
    endwhile;
    wp_reset_postdata();

get_events_relative_to() args , , ( ai1ec , wp pagination), ..it . $events = $get_events ['events'] $events foreach, post_ids.

ai1ec, , .
echo apply_filters( 'the_content', $event->post->post_content );
HTML, , .

+5

$post_ids . $args 'orderby' = > 'post__in'

 $args = array(
        'posts_per_page'  => 4,
        'paged' => get_query_var('paged'),
        'post_type'=> 'ai1ec_event',
        'post__in' => $post_ids,
        'orderby' => 'post__in'
    );
+1
source

All Articles