How do I sort by event date in a custom loop?

Home Forums Calendar Products Events Calendar PRO How do I sort by event date in a custom loop?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #903591
    fbit
    Participant

    Hi guys.

    I’m making a simple slideshow from the Events plugin. I’m using a custom query. I’ve started off with this:

    $args = array(
    ‘post_type’ => ‘tribe_events’,
    ‘tribe_events_cat’ => ‘featured’
    ) ;

    This works fine. But I’d like to filter further. I’d like to get publish only upcoming events.
    I imagine that the dates a stored in post meta, so I would identify the ‘event date’ post meta, and then use the orderby’ with ‘meta_value’.

    I’ll be working on this in earnest tomorrow. But I thought I’d post this now, just in case anyone has a snippet at hand, or can point me to one.

    Thanks.

    #903814
    Geoff
    Member

    Hi there, Kenneth! Thanks for getting in touch. 🙂

    Great question. I do want to note first of all, though, that we are fairly limited in terms of helping out with custom development questions like this one. That said, we’d love to point you in the right direction if we can.

    You might want to consider using tribe_get_events() to build your query instead. This will allow you to filter the eventDisplay to “upcoming” which will weed out your past events. It’s certainly possible to achieve the same thing in your existing query, but this way might be a little easier.

    Give that a shot–I hope it helps. 🙂

    Cheers!
    Geoff

    #911908
    Geoff
    Member

    Hey there, Kenneth! Just checking in to see if there’s been any further update or if you still need assistance on this one–let me know. 🙂

    Cheers!
    Geoff

    #918789
    Geoff
    Member

    Hey there, Kenneth! 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 open a new thread. We’d be happy to help. 🙂

    Cheers!
    Geoff

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘How do I sort by event date in a custom loop?’ is closed to new replies.