Set timezone and status for The Events Calendar #46

Merged
linos merged 1 commit from improve_tribe_transformer into main 2024-10-02 19:53:14 +02:00
2 changed files with 21 additions and 1 deletions

View file

@ -301,6 +301,17 @@ abstract class Event extends Post {
return $summary;
}
/**
* By default set the timezone of the WordPress site.
*
* This is likely to be overwritten by the actual transformer.
*
* @return string The timezone string of the site.
*/
public function get_timezone(): string {
return wp_timezone_string();
}
/**
* Remove the permalink shortcode from a WordPress template.
*

View file

@ -94,7 +94,7 @@ final class The_Events_Calendar extends Event {
*
* @return string status of the event
*/
public function get_tribe_status() {
public function get_status() {
if ( 'canceled' === $this->tribe_event->event_status ) {
return 'CANCELLED';
}
@ -179,4 +179,13 @@ final class The_Events_Calendar extends Event {
return $location;
}
/**
* Get the timezone of the event.
*
* @return string The timezone string of the site.
*/
public function get_timezone(): string {
return $this->tribe_event->timezone;
}
}