Forum Replies Created
-
AuthorPosts
-
June 6, 2018 at 1:27 am in reply to: Trouble understanding start_date in tribe_get_events() #1547148sabineviParticipant
Thanks for the correction of the ordering snippet!
This is the complete code of the testpage template:
<?php /* Template Name: testevents */ get_header(); $now_amsterdam = new DateTime( 'now', new DateTimeZone( 'Europe/Amsterdam' ) ); $aEvents = tribe_get_events( array( 'start_date' => $now_amsterdam, 'posts_per_page' => -1 ) ); echo '<table border="1"><tr><td>title</td><td>start</td><td>end</td></tr>'; foreach( $aEvents as $o ) { echo '<tr><td><b>'.$o->post_title.' </b></td>'; echo '<td>'.$o->EventStartDate.' </td>'; echo '<td>: '.$o->EventEndDate.'</td></tr>'; } echo '</table>'; get_footer();
June 4, 2018 at 3:13 am in reply to: Trouble understanding start_date in tribe_get_events() #1545288sabineviParticipantI have to add that I have an alternative ordering set in the functions.php:
function tribe_post_alternatieve_sortering( $query ) { $query->set( 'orderby', 'start_date' ); $query->set( 'order', 'DESC' ); return $query; } add_action( 'pre_get_posts', 'tribe_post_alternatieve_sortering', 51 );
June 3, 2018 at 3:20 pm in reply to: Trouble understanding start_date in tribe_get_events() #1545056sabineviParticipantHi Cliff,
Thanks for your reply! I don’t think the timezone is the issue here. This website deals with art-exhibitions that most of the time end several months after they start so I think it’s a date-problem, not a time-problem.
If you have a look at my testpage (where I use this tribe_get_events) you can see that the events there have start dates between January 2018 and July 2018. I would expect to see only the top six events since those are the only ones that start after today (June 3rd). What am I missing here?sabineviParticipantYES! Thank you very much Barry, problem solved
sabineviParticipantHi Brook,
Thanks for your solution. I think I must have omitted a semi-colon or comma in my initial code because I managed to get it to work.
For those of you who come here looking for answers, this is the code I used in the overridden single-venu.php:do_action('tribe_events_single_venue_before_upcoming_events') // First show upcoming events echo tribe_include_view_list( array( 'venue' => $venue_id, 'eventDisplay' => 'upcoming', 'posts_per_page' => apply_filters( 'tribe_events_single_venue_posts_per_page', 100 ) ) ); // and then those from the past wp_reset_postdata(); echo tribe_include_view_list( array( 'venue' => $venue_id, 'eventDisplay' => 'past', 'posts_per_page' => apply_filters( 'tribe_events_single_venue_posts_per_page', 100 ) ) ); do_action('tribe_events_single_venue_after_upcoming_events');
sabineviParticipantThanks for your fast reply Casey. I had a look at the Event Rocket plugin and it can actually do what I thought my client wanted. But then it turned out that he wanted to have the first upcoming event of each of the four categories on the homepage and I can probably achieve that with the help of this page in the documentation: https://theeventscalendar.com/support/documentation/the-events-calendar-template-tags-general-functions/#functiontribe_get_events.
Thanks again!sabineviParticipantThank you Casey, I was having the same issue and it’s resolved now!
-
AuthorPosts