/** * Fetches the JSON-LD data for this type of object * * @param int|WP_Post|null $post The post/organizer * @param array $args * @return array */ public function get_data($post = null, $args = array('context' => false)) { $data = parent::get_data($post, $args); // If we have an Empty data we just skip if (empty($data)) { return array(); } // Fetch first key $post_id = key($data); // Fetch first Value $data = reset($data); $data->telephone = tribe_get_organizer_phone($post_id); $data->email = tribe_get_organizer_email($post_id); $data->sameAs = tribe_get_organizer_website_url($post_id); return array($post_id => $data); }
<?php /** * Single Event Meta (Organizer) Template * * Override this template in your own theme by creating a file at: * [your-theme]/tribe-events/modules/meta/details.php * * @package TribeEventsCalendar */ $organizer_ids = tribe_get_organizer_ids(); $multiple = count($organizer_ids) > 1; $phone = tribe_get_organizer_phone(); $email = tribe_get_organizer_email(); $website = tribe_get_organizer_website_link(); ?> <div class="tribe-events-meta-group tribe-events-meta-group-organizer"> <!-- h3 class="tribe-events-single-section-title"><?php echo tribe_get_organizer_label(!$multiple); ?> </h3 --> <h3 class="tribe-events-single-section-title">Instructor</h3> <dl> <?php do_action('tribe_events_single_meta_organizer_section_start'); foreach ($organizer_ids as $organizer) { if (!$organizer) { continue; } ?>
/** * Generates the iCal file * * @static * * @param int|null $post If you want the ical file for a single event */ public static function generate_ical_feed($post = null) { $tec = Tribe__Events__Main::instance(); $events = ''; $blogHome = get_bloginfo('url'); $blogName = get_bloginfo('name'); if ($post) { $events_posts = is_array($post) ? $post : array($post); } else { if (tribe_is_month()) { $events_posts = self::get_month_view_events(); } else { global $wp_query; $events_posts = $wp_query->posts; } } $event_ids = wp_list_pluck($events_posts, 'ID'); foreach ($events_posts as $event_post) { // add fields to iCal output $item = array(); $full_format = 'Ymd\\THis'; $time = (object) array('start' => self::wp_strtotime($event_post->EventStartDate), 'end' => self::wp_strtotime($event_post->EventEndDate), 'modified' => self::wp_strtotime($event_post->post_modified), 'created' => self::wp_strtotime($event_post->post_date)); if ('yes' == get_post_meta($event_post->ID, '_EventAllDay', true)) { $type = 'DATE'; $format = 'Ymd'; } else { $type = 'DATE-TIME'; $format = $full_format; } $tzoned = (object) array('start' => date($format, $time->start), 'end' => date($format, $time->end), 'modified' => date($format, $time->modified), 'created' => date($format, $time->created)); if ('DATE' === $type) { $item[] = "DTSTART;VALUE={$type}:" . $tzoned->start; $item[] = "DTEND;VALUE={$type}:" . $tzoned->end; } else { $tz = get_option('timezone_string'); $item[] = 'DTSTART;TZID="' . $tz . '":' . $tzoned->start; $item[] = 'DTEND;TZID="' . $tz . '":' . $tzoned->end; } $item[] = 'DTSTAMP:' . date($full_format, time()); $item[] = 'CREATED:' . $tzoned->created; $item[] = 'LAST-MODIFIED:' . $tzoned->modified; $item[] = 'UID:' . $event_post->ID . '-' . $time->start . '-' . $time->end . '@' . parse_url(home_url('/'), PHP_URL_HOST); $item[] = 'SUMMARY:' . str_replace(array(',', "\n", "\r", "\t"), array('\\,', '\\n', '', '\\t'), html_entity_decode(strip_tags($event_post->post_title), ENT_QUOTES)); $item[] = 'DESCRIPTION:' . str_replace(array(',', "\n", "\r", "\t"), array('\\,', '\\n', '', '\\t'), html_entity_decode(strip_tags($event_post->post_content), ENT_QUOTES)); $item[] = 'URL:' . get_permalink($event_post->ID); // add location if available $location = $tec->fullAddressString($event_post->ID); if (!empty($location)) { $str_location = str_replace(array(',', "\n"), array('\\,', '\\n'), html_entity_decode($location, ENT_QUOTES)); $item[] = 'LOCATION:' . $str_location; } // add geo coordinates if available if (class_exists('Tribe__Events__Pro__Geo_Loc')) { $long = Tribe__Events__Pro__Geo_Loc::instance()->get_lng_for_event($event_post->ID); $lat = Tribe__Events__Pro__Geo_Loc::instance()->get_lat_for_event($event_post->ID); if (!empty($long) && !empty($lat)) { $item[] = sprintf('GEO:%s;%s', $lat, $long); $str_title = str_replace(array(',', "\n"), array('\\,', '\\n'), html_entity_decode(tribe_get_address($event_post->ID), ENT_QUOTES)); if (!empty($str_title) && !empty($str_location)) { $item[] = 'X-APPLE-STRUCTURED-LOCATION;VALUE=URI;X-ADDRESS=' . str_replace('\\,', '', trim($str_location)) . ';' . 'X-APPLE-RADIUS=500;' . 'X-TITLE=' . trim($str_title) . ':geo:' . $long . ',' . $lat; } } } // add categories if available $event_cats = (array) wp_get_object_terms($event_post->ID, Tribe__Events__Main::TAXONOMY, array('fields' => 'names')); if (!empty($event_cats)) { $item[] = 'CATEGORIES:' . html_entity_decode(join(',', $event_cats), ENT_QUOTES); } // add featured image if available if (has_post_thumbnail($event_post->ID)) { $thumbnail_id = get_post_thumbnail_id($event_post->ID); $thumbnail_url = wp_get_attachment_url($thumbnail_id); $thumbnail_mime_type = get_post_mime_type($thumbnail_id); $item[] = apply_filters('tribe_ical_feed_item_thumbnail', sprintf('ATTACH;FMTTYPE=%s:%s', $thumbnail_mime_type, $thumbnail_url), $event_post->ID); } // add organizer if available $organizer_email = tribe_get_organizer_email($event_post->ID); if ($organizer_email) { $organizer_id = tribe_get_organizer_id($event_post->ID); $organizer = get_post($organizer_id); if ($organizer_id) { $item[] = sprintf('ORGANIZER;CN="%s":MAILTO:%s', rawurlencode($organizer->post_title), $organizer_email); } else { $item[] = sprintf('ORGANIZER:MAILTO:%s', $organizer_email); } } $item = apply_filters('tribe_ical_feed_item', $item, $event_post); $events .= "BEGIN:VEVENT\r\n" . implode("\r\n", $item) . "\r\nEND:VEVENT\r\n"; } header('Content-type: text/calendar; charset=UTF-8'); header('Content-Disposition: attachment; filename="ical-event-' . implode($event_ids) . '.ics"'); $content = "BEGIN:VCALENDAR\r\n"; $content .= "VERSION:2.0\r\n"; $content .= 'PRODID:-//' . $blogName . ' - ECPv' . Tribe__Events__Main::VERSION . "//NONSGML v1.0//EN\r\n"; $content .= "CALSCALE:GREGORIAN\r\n"; $content .= "METHOD:PUBLISH\r\n"; $content .= 'X-WR-CALNAME:' . apply_filters('tribe_ical_feed_calname', $blogName) . "\r\n"; $content .= 'X-ORIGINAL-URL:' . $blogHome . "\r\n"; $content .= 'X-WR-CALDESC:Events for ' . $blogName . "\r\n"; $content = apply_filters('tribe_ical_properties', $content); $content .= $events; $content .= 'END:VCALENDAR'; echo $content; exit; }
/** * Get organizer email * * @param int $meta_id * @return string */ public static function organizer_email($meta_id) { global $_tribe_meta_factory; $email = tribe_get_organizer_email(); $organizer_email = empty($email) ? '' : Tribe_Meta_Factory::template($_tribe_meta_factory->meta[$meta_id]['label'], '<a href="mailto:' . $email . '">' . $email . '</a>', $meta_id); return apply_filters('tribe_event_meta_organizer_email', $organizer_email); }
/** * @deprecated */ function sp_get_organizer_email($postId = null) { _deprecated_function(__FUNCTION__, '2.0', 'tribe_get_organizer_email()'); return tribe_get_organizer_email($postId); }
<div class="single-event-popup <?php echo tribe_events_event_classes( $event_id ); ?>"> <div class="col-sm-4"> <?php echo tribe_event_featured_image( $event_id, 'event-popup', false ); ?> </div> <div class="col-sm-8"> <h2 class="event-title"><?php echo $event->post_title; ?></h2> <?php echo apply_filters( 'the_content', $event->post_content ); ?> <ul class="meta-info"> <li><label>What:</label> <?php echo $event->post_title; ?></li> <li><label>When:</label> <?php echo tribe_events_event_schedule_details( $event_id ); ?></li> <?php if ( tribe_address_exists( $event_id ) ) : ?> <li><label>Where:</label> <?php echo tribe_get_full_address( $event_id ); ?></li> <?php endif; ?> <li><label>Cost:</label> <?php echo get_post_meta( $event_id, '_ecp_custom_2', true ); ?></li> <?php if ( tribe_has_organizer( $event_id ) ): ?> <li><label>Info:</label> <a href="mailto:<?php echo tribe_get_organizer_email( $event_id ); ?>"><?php echo tribe_get_organizer_email( $event_id ); ?></a></li> <?php endif; ?> <li><label>Register:</label> <?php echo get_post_meta( $event_id, '_ecp_custom_5', true ); ?></li> </ul> <?php echo bones_get_edit_link( $event_id ); ?> </div> </div>
<?php } ?> <?php if (tribe_get_organizer_email()) { ?> <dt class="event-label event-label-email"><?php _e('Email:', 'tribe-events-calendar'); ?> </dt> <dd itemprop="email" class="event-meta event-meta-email"><a href="mailto:<?php echo tribe_get_organizer_email(); ?> "><?php echo tribe_get_organizer_email(); ?> </a></dd> <?php } ?> <dt class="event-label event-label-updated"><?php _e('Updated:', 'tribe-events-calendar'); ?> </dt> <dd class="event-meta event-meta-updated"><span class="date updated"><?php the_date(); ?> </span></dd>
/** * Returns a summary of key information for the specified organizer. * * Typically this is a pipe separated format containing the organizer's telephone * number, email address and website where available. * * @param int $post_id * * @return string */ function tribe_get_organizer_details($post_id = null) { $post_id = Tribe__Events__Main::postIdHelper($post_id); $organizer_id = (int) tribe_get_organizer_id($post_id); $details = array(); if ($organizer_id && ($tel = tribe_get_organizer_phone())) { $details[] = '<span class="tel">' . $tel . '</span>'; } if ($organizer_id && ($email = tribe_get_organizer_email())) { $details[] = '<span class="email"> <a href="mailto:' . esc_attr($email) . '">' . $email . '</a> </span>'; } if ($organizer_id && ($link = tribe_get_organizer_website_link())) { $details[] = '<span class="link"> <a href="' . esc_attr($link) . '">' . $link . '</a> </span>'; } $html = join('<span class="tribe-events-divider">|</span>', $details); if (!empty($html)) { $html = '<address class="organizer-address">' . $html . '</address>'; } /** * Provides an opportunity to modify the organizer details HTML. * * @param string $html * @param int $post_id * @param int $organizer_id */ return apply_filters('tribe_get_organizer_details', $html, $post_id, $organizer_id); }
/** * Generates the iCal file * * @static * * @param int|null $post If you want the ical file for a single event */ public static function generate_ical_feed($post = null) { $tec = TribeEvents::instance(); $wp_timezone = get_option('timezone_string'); $events = ''; $blogHome = get_bloginfo('url'); $blogName = get_bloginfo('name'); if ($post) { $events_posts = array(); $events_posts[] = $post; } else { if (tribe_is_month()) { $events_posts = self::get_month_view_events(); } else { global $wp_query; $events_posts = $wp_query->posts; } } foreach ($events_posts as $event_post) { $startDate = $event_post->EventStartDate; $endDate = $event_post->EventEndDate; // convert 2010-04-08 00:00:00 to 20100408T000000 or YYYYMMDDTHHMMSS $startDate = str_replace(array('-', ' ', ':'), array('', 'T', ''), $startDate); $endDate = str_replace(array('-', ' ', ':'), array('', 'T', ''), $endDate); if (get_post_meta($event_post->ID, '_EventAllDay', true) == 'yes') { $startDate = substr($startDate, 0, 8); $endDate = substr($endDate, 0, 8); // endDate bumped ahead one day to counter iCal's off-by-one error $endDateStamp = strtotime($endDate); $endDate = date('Ymd', $endDateStamp + 86400); $type = 'DATE'; } else { $type = 'DATE-TIME'; } $description = preg_replace("/[\n\t\r]/", ' ', strip_tags($event_post->post_content)); // add fields to iCal output $item = array(); $item[] = "DTSTART;VALUE={$type}:" . $startDate; $item[] = "DTEND;VALUE={$type}:" . $endDate; $item[] = 'DTSTAMP:' . date('Ymd\\THis', time()); $item[] = 'CREATED:' . str_replace(array('-', ' ', ':'), array('', 'T', ''), $event_post->post_date); $item[] = 'LAST-MODIFIED:' . str_replace(array('-', ' ', ':'), array('', 'T', ''), $event_post->post_modified); $item[] = 'UID:' . $event_post->ID . '-' . strtotime($startDate) . '-' . strtotime($endDate) . '@' . $blogHome; $item[] = 'SUMMARY:' . $event_post->post_title; $item[] = 'DESCRIPTION:' . str_replace(',', '\\,', $description); $item[] = 'URL:' . get_permalink($event_post->ID); // add location if available $location = $tec->fullAddressString($event_post->ID); if (!empty($location)) { $item[] = 'LOCATION:' . html_entity_decode($location, ENT_QUOTES); } // add geo coordinates if available if (class_exists('TribeEventsGeoLoc')) { $long = TribeEventsGeoLoc::instance()->get_lng_for_event($event_post->ID); $lat = TribeEventsGeoLoc::instance()->get_lat_for_event($event_post->ID); if (!empty($long) && !empty($lat)) { $item[] = sprintf('GEO:%s;%s', $long, $lat); } } // add categories if available $event_cats = (array) wp_get_object_terms($event_post->ID, TribeEvents::TAXONOMY, array('fields' => 'names')); if (!empty($event_cats)) { $item[] = 'CATEGORIES:' . html_entity_decode(join(',', $event_cats), ENT_QUOTES); } // add featured image if available if (has_post_thumbnail($event_post->ID)) { $thumbnail_id = get_post_thumbnail_id($event_post->ID); $thumbnail_url = wp_get_attachment_url($thumbnail_id); $thumbnail_mime_type = get_post_mime_type($thumbnail_id); $item[] = apply_filters('tribe_ical_feed_item_thumbnail', sprintf('ATTACH;FMTTYPE=%s:%s', $thumbnail_mime_type, $thumbnail_url), $event_post->ID); } // add organizer if available $organizer_email = tribe_get_organizer_email($event_post->ID); if ($organizer_email) { $organizer_name = tribe_get_organizer($event_post->ID); if ($organizer_name) { $item[] = sprintf('ORGANIZER;CN=%s:MAILTO:%s', $organizer_name, $organizer_email); } else { $item[] = sprintf('ORGANIZER:MAILTO:%s', $organizer_email); } } $item = apply_filters('tribe_ical_feed_item', $item, $event_post); $events .= "BEGIN:VEVENT\r\n" . implode("\r\n", $item) . "\r\nEND:VEVENT\r\n"; } header('Content-type: text/calendar; charset=UTF-8'); header('Content-Disposition: attachment; filename="iCal-TribeEvents.ics"'); $content = "BEGIN:VCALENDAR\r\n"; $content .= "VERSION:2.0\r\n"; $content .= 'PRODID:-//' . $blogName . ' - ECPv' . TribeEvents::VERSION . "//NONSGML v1.0//EN\r\n"; $content .= "CALSCALE:GREGORIAN\r\n"; $content .= "METHOD:PUBLISH\r\n"; $content .= 'X-WR-CALNAME:' . apply_filters('tribe_ical_feed_calname', $blogName) . "\r\n"; $content .= 'X-ORIGINAL-URL:' . $blogHome . "\r\n"; $content .= 'X-WR-CALDESC:Events for ' . $blogName . "\r\n"; if ($wp_timezone) { $content .= 'X-WR-TIMEZONE:' . $wp_timezone . "\r\n"; } $content = apply_filters('tribe_ical_properties', $content); $content .= $events; $content .= 'END:VCALENDAR'; echo $content; exit; }
* * Override this template in your own theme by creating a file at * [your-theme]/tribe-events/community/modules/organizer.php * * @package TribeCommunityEvents * @since 2.1 * @author Modern Tribe Inc. * */ if (!defined('ABSPATH')) { die('-1'); } $organizer_name = esc_attr(tribe_get_organizer()); $organizer_phone = esc_attr(tribe_get_organizer_phone()); $organizer_website = esc_url(tribe_get_organizer_website_url()); $organizer_email = esc_attr(tribe_get_organizer_email()); if (!isset($event)) { $event = null; } ?> <!-- Organizer --> <div class="tribe-events-community-details eventForm bubble" id="event_organizer"> <table class="tribe-community-event-info" cellspacing="0" cellpadding="0"> <tr> <td colspan="2" class="tribe_sectionheader"> <h4><?php _e('Event Organizer Details', 'tribe-events-community'); ?>
/** * Prints title organizer meta */ function grve_event_organizer_title_meta() { $phone = tribe_get_organizer_phone(); $email = tribe_get_organizer_email(); $website = tribe_get_organizer_website_link(); ob_start(); if (!empty($phone) || !empty($email) || !empty($website)) { ?> <div class="grve-event-organizer-title-meta"> <?php if (!empty($phone)) { ?> <span class="tel"> <?php echo $phone; ?> </span> <?php } ?> <?php if (!empty($email)) { ?> <span class="email"> <?php echo $email; ?> </span> <?php } ?> <?php if (!empty($website)) { ?> <span class="url"> <?php echo $website; ?> </span> <?php } ?> </div> <?php } return ob_get_clean(); }