Home › Forums › Calendar Products › Events Calendar PRO › Meta keys for start and end times
- This topic has 4 replies, 2 voices, and was last updated 9 years, 1 month ago by Matthew.
-
AuthorPosts
-
March 31, 2015 at 8:13 am #952237dotdashParticipant
Hello there,
Where would I locate the meta keys for the start and end time of an event?
I can’t find them here: https://theeventscalendar.com/knowledgebase/wordpress-post-meta-data/
Or, what would I use to display a time frame such as this: 10am – 12pm?
I am using EVP and WooTickets in conjunction with Essential Grid.
Cheers,
Spencer
March 31, 2015 at 8:39 am #952254MatthewMemberHowdy Spencer – great question!
The times for an event are stored along with the dates, so the meta keys that hold that information are _EventStartDate and _EventEndDate. However, there are a couple of handy functions that will allow you to easily display the date/time in whichever format best suits your needs! Check out tribe_get_start_date() and tribe_get_end_date() – both use PHP date formatting.
// 'ga' outputs the time in 12-hour time with am/pm after it echo tribe_get_start_date( $event_id, TRUE, 'ga' ) . ' - ' . tribe_get_end_date( $event_id, TRUE, 'ga' );
Does that point you in the right direction?
April 1, 2015 at 8:14 am #952552dotdashParticipantThis reply is private.
April 1, 2015 at 9:53 am #952580MatthewMemberI have never used Essential Grid…it looks like an awesome plugin! Sorry I don’t have more insight into implementation with it.
As for the code, you should be able to place that in a function in functions.php, perhaps like so:
// obviously rename this function to something that suits you :) function my_sweet_event_dates( $event_id ) { // 'ga' outputs the time in 12-hour time with am/pm after it echo tribe_get_start_date( $event_id, TRUE, 'ga' ) . ' - ' . tribe_get_end_date( $event_id, TRUE, 'ga' ); }
The tribe_get_start_date() and tribe_get_end_date() functions are awesome for shortening that date, plus you can output both the date and times.
Hopefully that helps!
April 20, 2015 at 9:39 am #956750MatthewMemberIt has been a while since our last communication, so I’m going to go ahead and close out this thread. If you have any other questions, don’t hesitate to start a new one! Thank you 🙂
-
AuthorPosts
- The topic ‘Meta keys for start and end times’ is closed to new replies.