Event Sorting

This topic contains 5 replies, has 3 voices, and was last updated by  Kiran 6 years, 8 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #388945

    Moez Tharani
    Full Member
    Post count: 60

    I’m trying to figure out if the API supports sorting events by start date. By default, it appears that the events are sorted by post date. I’m looking to sort them the same way the gd_event_listing shortcode sorts using list_sort=upcoming. Any help would be appreciated.

    #388992

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    The API developer has been alerted. He’ll let you know asap.

    Thanks

    #389093

    Kiran
    Moderator
    Post count: 7069

    Hi Moez,

    To filter events by upcoming/past use event_type parameter.

    &event_type=all – Lists all the events
    &event_type=upcoming – Lists all the upcoming events sort by nearest event
    &event_type=past – Lists the past events
    &event_type=today – Lists the events which are available on today’s date

    You can check all the schema parameters available for endpoints at root endpoint
    YOURSITE.COM/wp-json/geodir/v1/

    Let us know.

    Kiran

    #389094

    Moez Tharani
    Full Member
    Post count: 60

    Unfortunately, that doesn’t seem to address my issue. I’m more than happy to go digging through the code to change the default sorting, if I have to. We use a slightly modified version of your API to feed content to our mobile app (it doesn’t modify your code as it’s registered as a separate endpoint). The problem is that the data appears to be sorted by post_date. So /events?event_type=upcoming&page=1&per_page=10 shows me 10 event instances with the first two in August, the third in October and the fourth in September, because that’s the order I added them. The second page of results might show something completely different. So when our app pulls down that data, it will show 10 events and then when you scroll to get the next page, it adds events above. We’re working around this by pulling all events down at once, but that brings it’s own set of issues.

    The schema parameters for orderby for events shows that post_date is the default and nothing else (whereas the same thing for places shows more options). Is there a hidden way to sort by event_startdate? Because that would resolve all of our issues.

    #389096

    Moez Tharani
    Full Member
    Post count: 60
    This reply has been marked as private.
    #389122

    Kiran
    Moderator
    Post count: 7069

    Hi Moez,

    Now i re-created problem from my site. The problem has been fixed and will be available in next release of GeoDirectory API plugin.

    In case you if want patch then it is available at here: https://github.com/GeoDirectory/geodir_api/pull/21/files

    Kiran

Viewing 6 posts - 1 through 6 (of 6 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket