Displaying all events that are in the same „series“ as the displayed single even

Home Forums Calendar Products Events Calendar PRO Displaying all events that are in the same „series“ as the displayed single even

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1119710
    sven
    Participant

    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/SuZhRZ6V

    The 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!

    #1119943
    Cliff
    Member

    Hi 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.

    #1120026
    sven
    Participant

    No 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.

    #1120027
    sven
    Participant

    So, even setting the ‘EventDisplay’ to ‘costum’ does not exactly work.

    #1120156
    Cliff
    Member

    Hi 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.

    #1121123
    Dominik Schneider
    Participant

    Hi 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:00pm

    Sadly, 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 );
    				}	
    			}
    			
    #1121270
    Cliff
    Member

    I 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.

    #1129921
    Support Droid
    Keymaster

    This 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.

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Displaying all events that are in the same „series“ as the displayed single even’ is closed to new replies.