WordPress.org

Support

Support » Plugins and Hacks » Event Organiser » Events' archive doesn't show next page link

Events' archive doesn't show next page link

  • Hi,

    I’m using this query to get past events:

    $posts = eo_get_events(
          array(
               '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?

    Thanks,

    P.

    http://wordpress.org/plugins/event-organiser/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Stephen Harris

    @stephenharris

    Hi,

    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.

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Events' archive doesn't show next page link’ is closed to new replies.
Skip to toolbar