tribe_get_events sort order

Home Forums Calendar Products Events Calendar PRO tribe_get_events sort order

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #874771
    kqed
    Participant

    Hi – I made a widget to display events, but our editor would like the behavior to change from:
    display active event tagged “ongoing” ordered by start date
    to:
    display active event tagged “ongoing” ordered by end date

    I tried this but it didn’t have any effect:
    $upcoming = tribe_get_events( array(
    ‘eventDisplay’=>’upcoming’,
    ‘tag’=>’ongoing’,
    ‘orderby’=>’EventEndDate’,
    ‘posts_per_page’=>’-1′
    ) );

    Any advice would be appreciated!

    #875073
    Barry
    Member

    Hi kqed,

    That sounds like an interesting problem to solve 🙂

    We’re a bit limited in terms of how much assistance we can provide for custom development tasks, but I want to highlight first of all that the meta key for the end date is actually _EventEndDate (note the leading underscore). If changing that by itself doesn’t help, might it be possible to steer away from tribe_get_events() in this situation and use WP_Query directly?

    If you reference the orderby section of the WP_Query docs you can see it is possible to order against a meta key:

    codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters

    If that doesn’t work it may be that you need to do some more advanced work and change the where clause using other filters and hooks provided by WP_Query.

    I hope that at least provides some paths you can explore – and good luck!

    #896844
    Barry
    Member

    Hi! It’s been a while so I’m going to go ahead and close this thread. If we can help with anything else, though, please don’t hesitate to create new threads as needed. Thanks!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘tribe_get_events sort order’ is closed to new replies.