WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. Marshall
    Member
    Posted 5 months ago #

    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/

  2. Stephen Harris
    Member
    Plugin Author

    Posted 5 months ago #

    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.

  3. Marshall
    Member
    Posted 5 months ago #

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

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.