Home › Forums › Calendar Products › Events Calendar PRO › start_date and end_date not working in query.
- This topic has 7 replies, 2 voices, and was last updated 13 years, 7 months ago by
Barry.
-
AuthorPosts
-
September 14, 2012 at 7:33 am #25090
Mike
ParticipantHi 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!
September 14, 2012 at 7:50 am #25091Barry
MemberHi Mike. As a starting point could you try switching your date formats from ‘j M Y’ to ‘Y-m-d’?
September 14, 2012 at 7:54 am #25092Mike
ParticipantHi 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.
September 14, 2012 at 12:47 pm #25133Barry
MemberOK, 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.
September 16, 2012 at 9:18 am #25178Mike
ParticipantCould 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.
September 17, 2012 at 3:11 pm #25239Barry
MemberI 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.
September 18, 2012 at 3:43 am #25300Mike
ParticipantHi 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!
September 18, 2012 at 6:42 am #25304Barry
MemberNo 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 🙂
-
AuthorPosts
- The topic ‘start_date and end_date not working in query.’ is closed to new replies.
