Home › Forums › Calendar Products › Events Calendar PRO › Displaying all events that are in the same „series“ as the displayed single even
- This topic has 8 replies, 5 voices, and was last updated 7 years, 10 months ago by sven.
-
AuthorPosts
-
May 27, 2016 at 7:54 am #1119710svenParticipant
Hi,
I am trying to program an event-single page that not only displays the event I clicked on (via permalink) but all events that belong to the same series (via recurring events).
I have come so far:
http://pastebin.com/SuZhRZ6VThe problem is: The events will only be shown if they are in the future, not in the past. Event if I try things with eventDisplay inside the query. The query stays empty (probably, because my query fails to have posts).
Can anybody help?
Thanks!
May 27, 2016 at 3:14 pm #1119943CliffMemberHi Sven.
Event Single pages already display a link to “view all” in a recurrence series.
Example: http://cl.ly/382c381W1y3e from http://wpshindig.com/event/women-in-tech-monthly-meeting/2016-05-21/Please explain if you’re not seeing this on your site.
Thank you.
May 28, 2016 at 4:41 am #1120026svenParticipantNo I do not as stated in the pastebin.
I just need the correct field and value for the array to make the foreach-loop work, such as get_posts(‘eventDisplay’ => ‘all’), simply something with series. I find the documentation not complete on this.
As stated:
<? $args = array( 'post_type' => 'tribe_events', 'post_parent' => $event_id, 'order' => ASC, 'eventDisplay' => 'all' ); $recurring_series = new WP_Query( $args ); if( $recurring_series->have_posts() ) { ?> <div class="row"> <div class="col-xs-12"> <h3 class="tribe-events--event-single-more-dates">Weitere Termine:</h3> <div class="tribe-events--event-single-more-dates-list"> <? while( $recurring_series->have_posts() ) { $recurring_series->the_post(); ?> <span class="tribe-events--event-single-date-single"> <? echo tribe_get_start_date(); ?> </span> <? } ?> </div> </div> </div> <? } ?>
Only seems to work for future events, not for past events. I want to display ALL events of a recurring_event, not caring if future or past.
May 28, 2016 at 4:48 am #1120027svenParticipantSo, even setting the ‘EventDisplay’ to ‘costum’ does not exactly work.
May 28, 2016 at 5:03 pm #1120156CliffMemberHi Sven.
While there are multiple functions/methods related to recurring events, there isn’t one that does just what you asked.
Please check out this code snippet; I hope you find it useful:
https://gist.github.com/cliffordp/a77f4943e13f9e4e243564a210f82c83
As-is, it renders like this: http://cl.ly/1h383J1b3L0P
I assume you’ll want to customize it in some ways.
Recurring events logic utilizes the WordPress parent/child relationship, which is why this code uses wp_get_post_parent_id()
Also, tribe_get_events() is used.
FYI: For future reference, we are limited in coding/customization assistance, but I went a bit above and beyond for you because I had some extra free time and because of your thoroughness with sharing your own code already. I hope my code helps you get across the finish line.
June 1, 2016 at 6:58 am #1121123Dominik SchneiderParticipantHi Cliff,
thanks a lot for your code snippet! It is very useful. Can’t believe this feature is not available as basic option within the plugin.
I was trying to modify the basic, to get displayed all recurrent events in a list like this (order by date):
10.9. | Mon. | 1:00pm
11.9. | Tue. | 1:00pm
12.9. | Wed. | 1:00pmSadly, the loop is not working to get displayed the date of each event.
Do you have any idea, how to fix that problem?foreach( $all_event_ids_in_recurrence_series as $key => $value ) { if ( $event_id !== $value ) { $date_day = tribe_get_start_date($post->ID, false, j); $date_month = tribe_get_start_date($post->ID, false,m); $date_weekday = tribe_get_start_date($post->ID, false,D); $date_time = tribe_get_start_date($post->ID, false, 'H:i'); printf( '<li><a href="%s">'.$date_day.'.'.$date_month.' | '.$date_weekday.' | '.$date_time.' | '.get_the_title().'</a></li>', esc_url( tribe_get_event_link( $value ) ), $key+1 ); } }
June 1, 2016 at 10:15 am #1121270CliffMemberI think you’ll need to figure this part out on your own using each item’s ID to get that event’s details, and we are limited on how much customization assistance we can provide.
June 21, 2016 at 9:35 am #1129921Support DroidKeymasterThis 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. -
AuthorPosts
- The topic ‘Displaying all events that are in the same „series“ as the displayed single even’ is closed to new replies.