Filtering to a date range using tribe_get_events()

Home Forums Calendar Products Events Calendar PRO Filtering to a date range using tribe_get_events()

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #31997
    unaoc
    Participant

    I’m trying to use tribe_get_events() to search for events that fall within a specific date range, similar to example #2 under the function on https://theeventscalendar.com/support/documentation/the-events-calendar-template-tags-general-functions/ , but no matter what dates or formatting I use for start_date and end_date, it seems to return the “upcoming” posts. This is also the same result that I get if I omit start_date and end_date from the arguments array.

    I did get a different result when I used the value of time() for start_date and end_date – it returned the past events with the earliest start dates – but this result stayed the same regardless of if I changed the range or multiplied the value of time() by anything.

    #32056
    Barry
    Member

    Hi Aaron, yep this is (currently) a little counter-intuitive. What are you setting the eventDisplay parameter to?

    #32098
    unaoc
    Participant

    Aha! As per the example in the documentation, I was omitting the eventDisplay paramater, but it seems that when that paramater is omitted it defaults to ‘upcoming’ and ignores ‘start_date’ and ‘end_date’. When I add ‘eventDisplay’=>’all’, everything works as expected.
    Thanks!

    #32100
    Barry
    Member

    No problem, glad you’re all sorted here 🙂

    #978544
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Filtering to a date range using tribe_get_events()’ is closed to new replies.