Single Training Course on Multiple days

Home Forums Calendar Products Events Calendar PRO Single Training Course on Multiple days

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1442324
    Sean
    Participant

    Hi,

    We are building a site for a client, who wants to show an event (a training course) and on that same page show all of the available days that the course is on.

    So a page may show the course details and then show:

    • Tuesday, 19th January @ 9am
    • Friday, 16th March @ 9am
    • Wednesday, 23rd May @ 9am
    • Monday, 22nd July @ 9am

    They just want a single page to show the event detail and then show a list of available dates.
    They do not want 4 pages to show the four events as they are the same event, just with 4 available dates.

    How can this be done ?

    #1445957
    Geoff B.
    Member

    Good evening Sean and welcome back!

    Thank you for reaching out to us.
    I would love to help you with this topic.

    show an event (a training course) and on that same page show all of the available days that the course is on.

    If I understand correctly, only the single event view would be used (not the month or list view). Can you confirm ?

    They just want a single page to show the event detail and then show a list of available dates.

    In that case, you could simply use the Events Calendar Pro recurring events feature and display the recurrences of the events in the single event view.

    The rest of the answer will depend on your answer to the first question.

    Have a great day!

    Geoff B.

    #1446009
    Sean
    Participant

    Hi, “In that case, you could simply use the Events Calendar Pro recurring events feature and display the recurrences of the events in the single event view.” sounds great….

    But how do I do this ?

    i don’t know how to “display the recurrences of the events in the single event view.”

    #1447084
    Geoff B.
    Member

    Good evening Sean,

    This can be accomplished by doing a template override (custom template view) of single-event.php.

    You might want to read our Themer’s guide to get a sense of how that works.

    Just to set expectations, the scope of our support is mostly to get our customers started on the right track and to help them in case of issues. We unfortunately do not provide complete support for customization.

    The good news is that there are several of our customers that have achieved this and that were kind enough to share:

    1. https://theeventscalendar.com/support/forums/topic/displaying-all/
    2. https://theeventscalendar.com/support/forums/topic/get-list-of-recurring-events-into-single-events-php/
    3. https://theeventscalendar.com/support/forums/topic/displaying-all-events-that-are-in-the-same-series-as-the-displayed-single-even/

    Let me know how that goes.

    Best regards,
    Geoff B.

    #1447354
    Sean
    Participant

    For the benefit of other – I’ve completed this with a new function:

    Below is my code

    if ( function_exists( 'cwd_display_recurring_events' ) ) {
    global $post;
    echo cwd_display_recurring_events( $post );
    }

    `function cwd_display_recurring_events( $post ) {

    $return = FALSE;
    
    if ( ! tribe_is_recurring_event() ) {
        return $return;
    }
    
    if ( is_null( $post ) ) {
        return $return;
    }
    
    $date_args = array (
        'posts_per_page' => - 1,
        'post_type'      => 'tribe_events',
        'orderby'        => 'meta_value',
        'meta_key'       => '_EventStartDate',
        'order'          => 'ASC'
    );
    
    if ( $post->post_parent != 0 ) {
        $date_args['post_parent'] = $post->post_parent;
    } else {
        $date_args['post_parent'] = $post->ID;
    }
    
    $date_query = new WP_Query( $date_args );
    if ( $date_query->have_posts() ) {
    
        $date_format = tribe_get_date_format();
    
        $return      .= '<div id="tribe-events-other-dates">';
        $return      .= '<h3>Other Course Dates</h3>';
        $return      .= '<p>This course is also available on:</p>';
        $return      .= '<ul>';
    
        while ( $date_query-&gt;have_posts() ) {
            $date_query-&gt;the_post();
    
            $event_id = get_the_ID();
    
            $event_start_unix = date( 'U', strtotime( get_post_meta( $event_id, '_EventStartDate', TRUE ) ) );
    
            $event_start_time = tribe_get_start_date( $event_id, TRUE, 'ga' );
            $event_end_time   = tribe_get_end_date( $event_id, TRUE, 'ga' );
    
            $return .= '<li>' .
                       date( $date_format, $event_start_unix ) .
                       ' @ ' . $event_start_time . ' - ' . $event_end_time .
                       '</li>';
        }
    
        $return .= '</ul>';
        $return .= '</div>';
    
    }
    wp_reset_postdata();
    
    return $return . ' ';
    

    }`

    #1448103
    Geoff B.
    Member

    Hey there Sean,

    This is awesome. Thank you for sharing.

    You are welcome back in our support forums any time 🙂

    For now, I am going to close this thread.

    Have a great week!

    Geoff B.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Single Training Course on Multiple days’ is closed to new replies.