Home › Forums › Calendar Products › Events Calendar PRO › Timezones
- This topic has 2 replies, 2 voices, and was last updated 9 years, 7 months ago by Barry.
-
AuthorPosts
-
July 31, 2014 at 2:32 pm #550567dliciagaParticipant
I have conference calls that I am posting events on and need to display the time in several timezones – EST, CST, MST, PST
How can this be accomplished?August 1, 2014 at 8:48 am #558015BarryMemberHi!
The first thing to do here is take a look at our Themer’s Guide which covers the basics of safely overriding and customizing our templates 🙂
From there it really depends on where exactly you want to implement this feature – if it’s to occur within actual event posts then you’ll probably be interested in setting up a custom tribe-events/single-event.php template (based on the main views/single-event.php template found in The Events Calendar’s plugin directory).
Some code like this should allow you to grab the existing time, change the timezone and display the result:
$starts_on = tribe_get_start_date( null, false, 'Y-m-d H:i:s' ); $source_tz = 'America/Los_Angeles'; $target_tz = array( 'America/Edmonton', 'America/New_York' ); $date_time = new DateTime( $starts_on, new DateTimeZone( $source_tz ) ); foreach ( $target_tz as $new_tz ) echo $date_time->setTimezone( new DateTimeZone( $new_tz ) )->format( 'H:i (e)' );
You might position this just after the loop starts, which in the context of single-event.php is marked be these lines:
<?php while ( have_posts() ) : the_post(); ?> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
This is a relatively advanced customization so it’s something we’ll really need to leave in your hands in terms of ironing out the details – but I hope this gives you a few ideas that will help you to get started.
Good luck 🙂
September 4, 2014 at 8:39 pm #723612BarryMemberHi! It’s been a while so I’m going to go ahead and close this thread. If we can help with anything else, though, please don’t hesitate to create new threads as needed. Thanks!
-
AuthorPosts
- The topic ‘Timezones’ is closed to new replies.