Skip Navigation

[Resolved] start / end times for tribe events

This support ticket is created 5 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 2 replies, has 2 voices.

Last updated by emilyr 5 years, 9 months ago.

Assisted by: Waqar.

Author
Posts
#1246737

hi there–
trying to bring in start and end times from the tribe events plugin into my view. this thread: https://toolset.com/forums/topic/event-start-date/ shows me how to bring in the start time, and i can add a second shortcode to bring in the end times by just replacing 'start' with 'end'.

the issue is that events on a single day, repeat the day:
June 13 @ 6:00 pm - June 13 @ 8:00 pm

how can i make those single day events look like this:
JUNE 13 @ 6:00 PM - 8:00 PM

?

thanks!

#1246870

Hi Emily,

Thank you for contacting us and I'll be happy to assist.

To adjust to the events which have the same date but different times, you can follow these steps:

1. You'll update the code for the custom shortcodes from that thread ( https://toolset.com/forums/topic/event-start-date/ ) so that the format of the date and time can be changed when needed.

Example:


add_shortcode('tribe-start-date', 'tribe_start_date_shortcode');
function tribe_start_date_shortcode($atts) {
	$a = shortcode_atts( array(
		'format' => '',
	), $atts );

	global $post;

	if(!empty($a['format']))
	{
		return tribe_get_start_date( $post->ID, true, $a['format'] );
	}
	else
	{
		return tribe_get_start_date( $post->ID, true );
	}
	
}


add_shortcode('tribe-end-date', 'tribe_end_date_shortcode');
function tribe_end_date_shortcode($atts) {
	$a = shortcode_atts( array(
		'format' => '',
	), $atts );

	global $post;

	if(!empty($a['format']))
	{
		return tribe_get_end_date( $post->ID, true, $a['format'] );
	}
	else
	{
		return tribe_get_end_date( $post->ID, true );
	}
}

2. Next, please add the names of these two shortcodes "tribe-start-date" and "tribe-end-date" in the "Third-party shortcode arguments" section, at WP Admin -> Toolset -> Settings -> Front-end Content.

3. After that, you'll be able to use these two shortcodes in conditional display blocks, so that only the event end time and not the date is shown when it is the same as the event's start date:
( ref: https://toolset.com/documentation/user-guides/conditional-html-output-in-views/ )


[tribe-start-date] -
[wpv-conditional if="( '[tribe-start-date format="F j, Y"]' eq '[tribe-end-date  format="F j, Y"]' )"]
[tribe-end-date format="g:i a"]
[/wpv-conditional]
[wpv-conditional if="( '[tribe-start-date format="F j, Y"]' ne '[tribe-end-date  format="F j, Y"]' )"]
[tribe-end-date]
[/wpv-conditional]

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1247116

My issue is resolved now. Thank you!