start_date and end_date not working in query.

Home Forums Calendar Products Events Calendar PRO start_date and end_date not working in query.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #25090
    Mike
    Participant

    Hi guys,

    I’ve come across a problem where I cannot get the start_date and end_date filters to work in my query. Please see my code here: http://pastebin.com/k1beumd2

    This section of code takes the current date and also the start and end dates for the following 3 months, the end goal is to have the next 3 months events displayed in 3 separate queries, but at the moment, the only event I have whilst testing is set up for 27th September is being pulled in with every query which have later start and end dates set. It should not be showing up in the later queries due to it not falling in between the respective start and end dates.

    Any help would be greatly appreciated!

    #25091
    Barry
    Member

    Hi Mike. As a starting point could you try switching your date formats from ‘j M Y’ to ‘Y-m-d’?

    #25092
    Mike
    Participant

    Hi Barry, thanks for getting back to me.

    I’ve tried changing the date formats, that hasn’t solved the issue. I was wondering if there was a correct format to use and couldn’t find anything in the documentation. I was just going by what I could find from some of the examples.

    #25133
    Barry
    Member

    OK, well distilling your code down to the basics and using the correct date format does seem to yield the expected results for me: http://pastebin.com/3pLzHj2g – so I’d definitely advise using ‘Y-m-d’ format.

    #25178
    Mike
    Participant

    Could it be possible that I cannot write more than one query using the tribe_get_events function? I use wp_reset_query after each one, but I need to have the category filter in the query to pull in the desired results.

    Thanks again.

    #25239
    Barry
    Member

    I don’t know of any limitation like that, certainly if you are calling wp_reset_query() everything ought to be good. I’ll try and make some time to check this out and see if I can run multiple queries of my own, but as I say it’s not a problem I’m aware of.

    #25300
    Mike
    Participant

    Hi again, Barry.

    Thanks for helping me out once again, but no need to spend time on investigating as my colleague has figured out the issue. It turns out that I have to include:

    ‘eventDisplay’ => ‘all’

    into the query for the multiple queries to run correctly. It’s probably worth the plugin devs noting this somewhere in the documentation for the tribe_get_events_function for other users. I wouldn’t have found this to be a requirement in the documentation (if the requirement is intended, of course)

    Anyway, issue solved, thanks again!

    #25304
    Barry
    Member

    No problem – glad you got it fixed. Thanks also for the feedback, I think this is definitely an area of the documentation we ought to do some work on 🙂

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘start_date and end_date not working in query.’ is closed to new replies.