Home › Forums › Calendar Products › Events Calendar PRO › Single Training Course on Multiple days
- This topic has 6 replies, 2 voices, and was last updated 6 years, 3 months ago by Sean.
-
AuthorPosts
-
February 2, 2018 at 3:36 am #1442324SeanParticipant
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 ?
February 6, 2018 at 11:02 pm #1445957Geoff B.MemberGood 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.
February 7, 2018 at 12:26 am #1446009SeanParticipantHi, “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.”
February 7, 2018 at 5:06 pm #1447084Geoff B.MemberGood 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:
- https://theeventscalendar.com/support/forums/topic/displaying-all/
- https://theeventscalendar.com/support/forums/topic/get-list-of-recurring-events-into-single-events-php/
- 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.February 8, 2018 at 2:07 am #1447354SeanParticipantFor 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->have_posts() ) { $date_query->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 . ' ';
}`
February 8, 2018 at 11:37 am #1448103Geoff B.MemberHey 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.
-
AuthorPosts
- The topic ‘Single Training Course on Multiple days’ is closed to new replies.