Пример #1
0
 /**
  * Fetches the JSON-LD data for this type of object
  *
  * @param  int|WP_Post|null $post The post/venue
  * @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->address = array();
     $data->address['streetAddress'] = tribe_get_address($post_id);
     $data->address['addressLocality'] = tribe_get_city($post_id);
     $data->address['addressRegion'] = tribe_get_region($post_id);
     $data->address['postalCode'] = tribe_get_zip($post_id);
     $data->address['addressCountry'] = tribe_get_country($post_id);
     // Filter empty entries and convert to object
     $data->address = (object) array_filter($data->address);
     $geo = tribe_get_coordinates($post_id);
     if (!empty($geo['lat']) && !empty($geo['lng'])) {
         $data->geo = (object) array('@type' => 'GeoCoordinates', 'latitude' => $geo['lat'], 'longitude' => $geo['lng']);
     }
     $data->telephone = tribe_get_phone($post_id);
     $data->sameAs = tribe_get_venue_website_url($post_id);
     return array($post_id => $data);
 }
Пример #2
0
 /**
  *  Returns a string version of the full address of an event
  *
  * @param int|WP_Post The post object or post id.
  *
  * @return string The event's address.
  */
 public function fullAddressString($postId = null)
 {
     $address = '';
     if (tribe_get_address($postId)) {
         $address .= tribe_get_address($postId);
     }
     if (tribe_get_city($postId)) {
         if ($address != '') {
             $address .= ', ';
         }
         $address .= tribe_get_city($postId);
     }
     if (tribe_get_region($postId)) {
         if ($address != '') {
             $address .= ', ';
         }
         $address .= tribe_get_region($postId);
     }
     if (tribe_get_zip($postId)) {
         if ($address != '') {
             $address .= ', ';
         }
         $address .= tribe_get_zip($postId);
     }
     if (tribe_get_country($postId)) {
         if ($address != '') {
             $address .= ', ';
         }
         $address .= tribe_get_country($postId);
     }
     return $address;
 }
Пример #3
0
 /**
  * Address Test
  *
  * Returns true if any of the following exist: address, city, state/province (region), country or zip
  *
  * @param int $postId Can supply either event id or venue id, if none specified, current post is used
  *
  * @return bool True if any part of an address exists
  */
 function tribe_address_exists($postId = null)
 {
     if (tribe_get_address($postId) || tribe_get_city($postId) || tribe_get_region($postId) || tribe_get_country($postId) || tribe_get_zip($postId) || tribe_is_venue_overwrite($postId) && tribe_get_coordinates($postId)) {
         return true;
     } else {
         return false;
     }
 }
Пример #4
0
 /**
  * Address Test
  *
  * Returns true if any of the following exist: address, city, state/province (region), country or zip
  *
  * @param int $postId Can supply either event id or venue id, if none specified, current post is used
  *
  * @return bool True if any part of an address exists
  */
 function tribe_address_exists($postId = null)
 {
     if (tribe_get_address($postId) || tribe_get_city($postId) || tribe_get_region($postId) || tribe_get_country($postId) || tribe_get_zip($postId)) {
         return true;
     } else {
         return false;
     }
 }
Пример #5
0
 /**
  * @deprecated
  */
 function sp_get_region($postId = null)
 {
     _deprecated_function(__FUNCTION__, '2.0', 'tribe_get_region()');
     return tribe_get_region($postId);
 }
Пример #6
0
		<?php 
if ($city && tribe_get_city() != '') {
    ?>
			<span class="locality"><?php 
    echo tribe_get_city();
    ?>
</span>
		<?php 
}
?>

		<?php 
if ($region && tribe_get_region() != '') {
    ?>
			<span class="region"><?php 
    echo tribe_get_region();
    ?>
</span>
		<?php 
}
?>

		<?php 
if ($zip && tribe_get_zip() != '') {
    ?>
			<span class="postal-code"><?php 
    echo tribe_get_zip();
    ?>
</span>
		<?php 
}
    echo tribe_get_city($venue_id);
    ?>
</span><span class="delimiter">,</span>
	<?php 
}
?>

	<?php 
// This location's abbreviated region. Full region name in the element title.
if (tribe_get_region($venue_id)) {
    ?>
		<abbr class="region tribe-events-abbr" title="<?php 
    esc_attr_e($full_region);
    ?>
"><?php 
    echo tribe_get_region($venue_id);
    ?>
</abbr>
	<?php 
}
?>

	<?php 
// This location's postal code.
if (tribe_get_zip($venue_id)) {
    ?>
		<span class="postal-code"><?php 
    echo tribe_get_zip($venue_id);
    ?>
</span>
	<?php 
Пример #8
0
    $space = true;
}
if ($address && tribe_get_address()) {
    $output .= $space ? '<br />' : '';
    $output .= tribe_get_address();
    $space = true;
}
if ($city && tribe_get_city() != '') {
    $output .= $space ? '<br />' : '';
    $output .= tribe_get_city() . ', ';
    $space = true;
}
if ($region && tribe_get_region()) {
    $output .= !$city ? '<br />' : '';
    $space = true;
    $output .= tribe_get_region();
} else {
    $output = rtrim($output, ', ');
}
if ($zip && tribe_get_zip() != '') {
    $output .= $space ? '<br />' : '';
    $output .= tribe_get_zip();
    $space = true;
}
if ($country && tribe_get_country() != '') {
    $output .= $space ? '<br />' : ' ';
    $output .= tribe_get_country();
}
if ($phone && tribe_get_phone() != '') {
    if ($output) {
        $output .= '<br/>';
Пример #9
0
 /**
  * Process event calendar tags
  */
 private function process_the_events_calendar_tags($content)
 {
     if (!function_exists('tribe_get_start_date')) {
         return $content;
     }
     // The Events Calendar
     $event_date_format = get_option('date_format');
     $event_time_format = get_option('time_format');
     $event_all_day = get_post_meta(get_the_ID(), '_EventAllDay', true);
     $event_start_date = tribe_get_start_date(get_the_ID(), false, $event_date_format);
     $event_start_time = tribe_get_start_date(get_the_ID(), false, $event_time_format);
     $event_end_date = tribe_get_end_date(get_the_ID(), false, $event_date_format);
     $event_end_time = tribe_get_end_date(get_the_ID(), false, $event_time_format);
     $separator = apply_filters("metaslider_tribe_separator", " - ");
     if ($event_all_day) {
         if ($event_start_date == $event_end_date) {
             $event_string = $event_start_date;
         } else {
             $event_string = $event_start_date . $separator . $event_end_date;
         }
     } else {
         if ($event_start_date == $event_end_date) {
             $event_string = $event_start_date . " " . $event_start_time . $separator . $event_end_time;
         } else {
             $event_string = $event_start_date . $separator . $event_end_date;
         }
     }
     $content = str_replace("{event_date}", $event_string, $content);
     $content = str_replace("{event_start_date}", $event_start_date, $content);
     $content = str_replace("{event_start_time}", $event_start_time, $content);
     $content = str_replace("{event_end_time}", $event_end_time, $content);
     $content = str_replace("{event_end_date}", $event_end_date, $content);
     $content = str_replace("{event_address}", tribe_get_address(get_the_ID()), $content);
     $content = str_replace("{event_city}", tribe_get_city(get_the_ID()), $content);
     $content = str_replace("{event_country}", tribe_get_country(get_the_ID()), $content);
     $content = str_replace("{event_full_address}", tribe_get_full_address(get_the_ID()), $content);
     $content = str_replace("{event_phone}", tribe_get_phone(get_the_ID()), $content);
     $content = str_replace("{event_province}", tribe_get_province(get_the_ID()), $content);
     $content = str_replace("{event_region}", tribe_get_region(get_the_ID()), $content);
     $content = str_replace("{event_state}", tribe_get_state(get_the_ID()), $content);
     $content = str_replace("{event_stateprovince}", tribe_get_stateprovince(get_the_ID()), $content);
     $content = str_replace("{event_venue}", tribe_get_venue(get_the_ID()), $content);
     $content = str_replace("{event_venue_id}", tribe_get_venue_id(get_the_ID()), $content);
     $content = str_replace("{event_venue_link}", tribe_get_venue_link(get_the_ID(), false), $content);
     $content = str_replace("{event_zip}", tribe_get_zip(get_the_ID()), $content);
     return $content;
 }
Пример #10
0
<div class="when">
	<?php 
echo tribe_get_start_date($post->ID, isset($start) ? $start : null);
if ($event->AllDay && isset($start) && $start) {
    echo ' <small>(' . __('All Day', 'tribe-events-calendar-pro') . ')</small>';
}
?>
 
</div>
<div class="loc">
	<?php 
if (tribe_get_city() != '') {
    echo tribe_get_city() . ', ';
}
if (tribe_get_region() != '') {
    echo tribe_get_region() . ', ';
}
if (tribe_get_country() != '') {
    echo tribe_get_country();
}
?>
</div>
<div class="event_body">
	<?php 
$content = apply_filters('the_content', strip_shortcodes($post->post_content));
$content = str_replace(']]>', ']]&gt;', $content);
echo wp_trim_words($content, apply_filters('excerpt_length', 55), apply_filters('excerpt_more', ' ' . '[...]'));
?>
</div>
<?php 
$alt_text = empty($alt_text) ? 'alt' : '';
Пример #11
0
        $address_out[] = '<span class="delimiter">,</span> ';
    }
}
// Get our full region
$our_province = tribe_get_event_meta($postId, '_VenueStateProvince', true);
$our_states = TribeEventsViewHelpers::loadStates();
$our_full_region = isset($our_states[$our_province]) ? $our_states[$our_province] : $our_province;
// Get our city
if (tribe_get_city($postId)) {
    $address_out[] = ' <span class="locality">' . tribe_get_city($postId) . '</span>';
    $address_out[] = '<span class="delimiter">,</span> ';
}
// Get our region
if (tribe_get_region($postId)) {
    if (count($address_out)) {
        $address_out[] = ' <abbr class="region tribe-events-abbr" title="' . $our_full_region . '">' . tribe_get_region($postId) . '</abbr>';
    }
}
// Get our postal code
if (tribe_get_zip($postId)) {
    $address_out[] = ' <span class="postal-code">' . tribe_get_zip($postId) . '</span>';
}
// Get our country
if (tribe_get_country($postId)) {
    if (count($address_out)) {
        $address_out[] = ' <span class="country-name">' . tribe_get_country($postId) . '</span>';
    }
}
echo implode('', $address_out);
?>
</span>
    $address_out[] = '<span itemprop="streetAddress">' . tribe_get_address($postId) . '</span>';
    ?>
	<?php 
}
?>

	<?php 
$cityregion = '';
if (tribe_get_city($postId)) {
    $cityregion .= tribe_get_city($postId);
}
if (tribe_get_region($postId)) {
    if ($cityregion != '') {
        $cityregion .= ', ';
    }
    $cityregion .= tribe_get_region($postId);
}
if ($cityregion != '') {
    ?>
		<?php 
    $address_out[] = '<span itemprop="addressRegion">' . $cityregion . '</span>';
    ?>
	<?php 
}
?>

	<?php 
if (tribe_get_zip($postId)) {
    ?>
		<?php 
    $address_out[] = '<span itemprop="postalCode">' . tribe_get_zip($postId) . '</span>';