Support » Plugin: Events Manager » Show only upcoming events in a slideshow

  • Hello,

    i’m trying to display events in a slideshow, it works perfect at one exception.

    the events are showing with passed events and i wanted it to show the next upcoming events only.

    this is my code :

    $slider = new WP_Query('post_type=event&orderby=event_start_date&order=DESC&showposts=5');

    Thanx in advance for your help / Merci d’avance pour votre aide

Viewing 7 replies - 1 through 7 (of 7 total)
  • You can use wp_query, the best way is to do this within the loop and use the EM_Event object.

    $EM_Event = get_em_event($post);

    However, all event values are stored as postmeta as well but with a _ at the start of the meta key e.g. _event_start_time


    thanks for you reply.

    could you show me an exemple of code ?

    i did not know how to do this.

    best regards

    Plugin Author Marcus


    to show upcoming events, you’d could do e.g.

    $events = EM_Events::get(array(‘limit’=>5));

    that’d give you an array of EM_Event objects which are essentially extended versions of the $post objects you’d get with get_posts() –

    ok, but how can i include this in my wp_query ?

    $slider = new WP_Query('post_type=event&orderby=event_start_date&order=DESC&showposts=5');

    Plugin Author Marcus


    To use wp_query you’d need to do a custom field search.

    There are start/end timestamps stored as _start_ts and _end_ts

    I’m not sure you can do this with a querystring as you did, you’d need to supply your argument as an array.

    its actually working thru wp-query but not in the good order and passed event still beeing displayed.

    i understand what you mean but sincerly i didnt know how to developp it.

    almost, when using the plugin we did not fill any custom field for event_start_date

    Plugin Author Marcus


    you’d have to fill in _event_start_date but we add it for you, that’s the datepicker where you choose your event start date. however the one you want is _start_ts as that’s a timestamp which can be easily ordered.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Show only upcoming events in a slideshow’ is closed to new replies.