Support » Plugin: The Events Calendar » Sort events in API

  • Resolved Andrei

    (@andreiigna)


    Hi,

    I use the Tribe events API to display events in a different page than WP and have a problem.
    The event can’t be sorted and oldest ones are always shown first, which is not a good thing for a event list (wanna show the newest)

    Checked here too https://wpshindig.com/wp-json/tribe/events/v1 and there’s no parameters for sorting, but has filtering (??)

    Can you add sorting to API?

    Cheers

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Barry

    (@barryhughes-1)

    Hi @andreiigna,

    The event can’t be sorted and oldest ones are always shown first, which is not a good thing for a event list (wanna show the newest)

    You should find it defaults to the same order as the upcoming events list. In fact, over at wpshindig.com this is exactly what I see:

    • Women’s Javascript Study Group – 2018-05-23 18:30:00
    • Seattle Beer&&Code – 2018-05-23 19:00:00
    • HackNight #CodeforCuritiba – 2018-05-23 19:00:00
    • Women’s Javascript Study Group – 2018-05-30 18:30:00

    …there’s no parameters for sorting, but has filtering (??)

    Are you referring to the functionality added by Filter Bar? If so, that is not currently implemented via the REST API but uses a different mechanism of its own.

    Can you add sorting to API?

    It’s a great idea – we’ll happily consider it. Mind posting a feature request outlining some of the types of sorting you are interested in over on our feature request page?

    Thanks!

    Thread Starter Andrei

    (@andreiigna)

    Hi Barry,

    Thanks for the reply. Took me a bit to check this, because on our API integration it wasn’t showing the events from newest to oldest.

    Found why – the sorting is lost if there any filtering params. Ex: https://wpshindig.com/wp-json/tribe/events/v1/events?start_date=2018-01-01+00:00:00 it starts with the events in Jan, even if there are events for Jun/Jul

    In some pages we need to add this filtering, to show past events too. By default the API shows only future events.

    Here are some examples which the API doesn’t support now:
    – show events between May 1, 2018 – May 31, 2018 sorted from newest to oldest. A parameters like order=desc would fix this
    – show all events (paginated of course), including past events too. A filter like status=future,past would be great

    Thanks

    I see what you’re talking about here. As Barry pointed out, we suggest using our Feature Request forum to submit your idea. We use this platform to gauge user interest in new feature ideas.

    Take care,
    Ed 🙂

    Thread Starter Andrei

    (@andreiigna)

    Hi Ed,

    This looks more like a bug, don’t think it falls under new features (but added it there anyway).
    Sorting is inconsistent on same API endpoint, thing which usually is regarded as a problem.

    Cheers

    Awesome!

    I’m going to go ahead and close out this thread — don’t hesitate to create a new one any time you need help!

    Take care,
    Ed 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Sort events in API’ is closed to new replies.