Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter XaviivaX

    (@xaviivax)

    I think it’s solved with ‘eo_get_events’. Works fine. Only show the past events.

    Is this correct?

    thanks

    [….]

    $events = eo_get_events(array(
    ‘numberposts’=>5,
    ‘event_start_before’=>’today’,
    ‘showpastevents’=>true,
    ));

    [….]

    Plugin Author Stephen Harris

    (@stephenharris)

    You’ll want to use pre_get_posts, and then check $query->is_main_query() and is_tax( 'event-category' ) both return true to ensure that the query you are modifying is the main query for the event category taxonomy page.

    Then set the query variables appropriately:

    $query->set( 'event_start_before', 'today' );
        $query->set( 'showpastevents', true );

    See this post for more details on pre_get_posts: http://wordpress.stackexchange.com/questions/50761/when-to-use-wp-query-query-posts-and-pre-get-posts/50762#50762

    Hope that helps!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show only past events in taxonomy-event-category.php’ is closed to new replies.