Event Organiser
Events' archive doesn't show next page link (3 posts)

  1. Dude
    Posted 2 years ago #


    I'm using this query to get past events:

    $posts = eo_get_events(
               'numberposts' => 20,
               'orderby' => 'eventstart',
               'order' => 'DESC',
               'showpastevents' => true,
               'event_end_before' => date('Y-m-d')

    This will bring the last 20 events but there's no link to the next page. Is there something i could do about that?




  2. Stephen Harris
    Plugin Author

    Posted 2 years ago #


    eo_get_posts() is like get_posts() in that it isn't intended for pagination (though it would possible to crowbar it in).

    In fact, (and its not clear if you are or not) if you're intending to use this within a template then you're fighting against the wind. WordPress works by converting the url into a query, performing that query and then selecting the template. If you're performing a query inside that template, then life if a bit more complicated.

    The 'automatic' pages (e.g. the events page, venue/category pages), handle work that way (they don't contain a query, they just output the results).

    For a 'past events' page I would probably create a rewrite rule (to make the url 'pretty'), and get that to set a query variable so I can identify the query. At pre_get_posts, check if the query is for past vents, and if so set the query as appropriate.

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

    I believe if you've selected 'show past events' in the settings you can get only past events with ?event_start_before=now appended to the url.

    Sorry for the scant details, but its quite involved.

  3. Dude
    Posted 2 years ago #

    Thank you for the detailed explanation. The solution is indeed complicated but i'll give it a try.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Event Organiser
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.