Forum Replies Created
-
AuthorPosts
-
October 24, 2012 at 1:13 pm in reply to: get_tribe_events() – start_date and end_date not working #27149
Nick
ParticipantNow that I’ve solved the date range issue I noticed pagination doesn’t work properly. I’m tackling that issue now.
I’ve searched how to do pagination for get_posts() and as far as I now the only way is to do an offset hack. According to one of your own blog posts you guys came to the same conclusion – so you guys recommended wp_query.
https://theeventscalendar.com/queries-and-pagination/But if I use wp_query, I lose all that hard work you guys did building a post-meta date range query 🙂
So, that’s how I came to the conclusion of re-writing your date range query using wp_query’s meta_query parameter.
October 24, 2012 at 10:16 am in reply to: get_tribe_events() – start_date and end_date not working #27137Nick
ParticipantI’ve noticed you guys use get_posts to run your queries. Wouldn’t it be better to use wp_query as it’s more efficient and also provides important info like max_pages for pagination. Don’t suppose you guys have it documented anywhere on how to write the proper meta_query for your dates?
Thanks,
NickOctober 24, 2012 at 9:54 am in reply to: get_tribe_events() – start_date and end_date not working #27134Nick
ParticipantOk, think I got it. We had a few events that had messed up end date entries.
So, in the end, the fix was the ‘eventDisplay’ => ‘all’
Thanks for your help.
October 24, 2012 at 9:47 am in reply to: get_tribe_events() – start_date and end_date not working #27132Nick
ParticipantHm, now it only works if I ask for a venue, search string, or event_cat in addition to the start_date/end_date – not with just the start_date/end_date.
October 24, 2012 at 9:22 am in reply to: get_tribe_events() – start_date and end_date not working #27131Nick
ParticipantHey Barry,
I tried this manual query as well: http://pastebin.com/xFLqjM3g
In this case I have a event at 10/25/12 7:00 pm, and I set the date range to 2012-11-01 to 2012-11-31, and the event still appears when it has expired. It seems to simply ignore the start_date and end_date parameters.Then I tried setting “upcoming” to “all” and suddenly everything started working. I can emulate “upcoming” by simply limiting the date to today forward in my form. Seems like the “eventDisplay” parameter was the issue.
Thanks,
NickOctober 22, 2012 at 2:04 pm in reply to: get_tribe_events() – start_date and end_date not working #26984Nick
ParticipantHi Barry,
Appreciate your assistance. Changed and same result: https://dl.dropbox.com/u/4014819/Screen%20Shot%202012-10-22%20at%204.01.52%20PM.png.I’ve pastebin’d my code here: http://pastebin.com/LQp7GhHV
I’m building the query array from url parameters passed from a form. I’ve tried several date formats, but assume it should be using the Y-m-d like in your code samples. I even tried to re-write this is a wp_query using meta_query – but that also works except for the date range filtering.Thanks again for your help,
NickNick
ParticipantGood to hear. I made my own patch in the mean time – probably not the best way to do it but it works.
Updated googleCalendarLink() function starring line 397:
[code]// Hack to load correct reocurrence dates
$postStartDate = tribe_get_start_date( $post->ID, true, ‘F j, Y’ );
$postEndDate = tribe_get_end_date( $post->ID, true, ‘F j, Y’ );// $start_date = strtotime( get_post_meta( $postId, ‘_EventStartDate’, true ) );
$start_date = strtotime( $postStartDate );//$end_date = strtotime( get_post_meta( $postId, ‘_EventEndDate’, true ) . ( get_post_meta( $postId, ‘_EventAllDay’, true ) ? ‘ + 1 day’ : ”) );
$end_date = strtotime( $postEndDate . ( get_post_meta( $postId, ‘_EventAllDay’, true ) ? ‘ + 1 day’ : ”) );
[/code]Nick
ParticipantReplicated a similar issue on the official tri.be demo:
http://demo.tri.be/event/developer-scrum/2012-09-06/
iCal link works fine, google calendar link add the event in March? -
AuthorPosts
