本文整理汇总了PHP中tribe_get_event_meta函数的典型用法代码示例。如果您正苦于以下问题:PHP tribe_get_event_meta函数的具体用法?PHP tribe_get_event_meta怎么用?PHP tribe_get_event_meta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tribe_get_event_meta函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tribe_get_end_date
/**
* End Date
*
* Returns the event end date
*
* @param int $event (optional)
* @param bool $displayTime If true shows date and time, if false only shows date
* @param string $dateFormat Allows date and time formating using standard php syntax (http://php.net/manual/en/function.date.php)
* @return string Date
* @since 2.0
*/
function tribe_get_end_date($event = null, $displayTime = true, $dateFormat = '')
{
if (is_null($event)) {
global $post;
$event = $post;
}
if (is_numeric($event)) {
$event = get_post($event);
}
if (tribe_event_is_all_day($event)) {
$displayTime = false;
}
if (empty($event->EventEndDate) && is_object($event)) {
$event->EventEndDate = tribe_get_event_meta($event->ID, '_EventEndDate', true);
}
if (isset($event->EventEndDate)) {
if (tribe_event_is_all_day($event) && empty($event->_end_date_fixed) && TribeDateUtils::timeOnly($event->EventEndDate) != '23:59:59' && TribeDateUtils::timeOnly(tribe_event_end_of_day()) != '23:59') {
// set the event end date to be one day earlier, if it's an all day event and the cutoff is past midnight
// @todo remove this once we can have all day events without a start / end time
$event->EventEndDate = date_create($event->EventEndDate);
$event->EventEndDate->modify('-1 day');
$event->EventEndDate = $event->EventEndDate->format(TribeDateUtils::DBDATEFORMAT);
$event->_end_date_fixed = true;
}
$date = strtotime($event->EventEndDate);
} else {
return;
// '—';
}
return tribe_event_format_date($date, $displayTime, $dateFormat);
}
示例2: build_data
/**
* Compile the schema.org event data into an array
*/
protected function build_data()
{
global $post;
$id = $post->ID;
$organizer_data = parent::build_data();
$organizer_data[$id]->{'@type'} = 'Person';
$organizer_data[$id]->telephone = esc_js(tribe_get_event_meta($id, '_OrganizerPhone', true));
$organizer_data[$id]->url = esc_js(tribe_get_event_meta($id, '_OrganizerWebsite', true));
$organizer_data[$id]->email = esc_js(tribe_get_event_meta($id, '_OrganizerEmail', true));
return $organizer_data;
}
示例3: get_event_costs
/**
* fetches an event's cost values
*
* @param int|WP_Post $event The Event post object or event ID
*
* @return array
*/
public function get_event_costs($event)
{
$event = get_post($event);
if (!is_object($event) || !$event instanceof WP_Post) {
return array();
}
if (!tribe_is_event($event->ID)) {
return array();
}
$costs = tribe_get_event_meta($event->ID, '_EventCost', false);
$parsed_costs = array();
foreach ($costs as $index => $value) {
if ('' === $value) {
continue;
}
$parsed_costs += $this->parse_cost_range($value);
}
return $parsed_costs;
}
示例4: build_data
/**
* Compile the schema.org event data into an array
*/
protected function build_data()
{
global $post;
$id = $post->ID;
$lat = tribe_get_event_meta($id, Tribe__Events__Pro__Geo_Loc::LAT);
$lng = tribe_get_event_meta($id, Tribe__Events__Pro__Geo_Loc::LNG);
$venue_data = parent::build_data();
$venue_data[$id]->{'@type'} = 'Place';
$venue_data[$id]->address = strip_tags(str_replace("\n", '', tribe_get_full_address($post->ID)));
$venue_data[$id]->url = esc_js(tribe_get_event_meta($id, '_VenueURL', true));
$venue_data[$id]->telephone = esc_js(tribe_get_event_meta($id, '_VenuePhone', true));
if ($lat && $lng) {
$venue_data[$id]->geo = new stdClass();
$venue_data[$id]->geo->{'@type'} = 'GeoCoordinates';
$venue_data[$id]->geo->latitude = esc_js($lat);
$venue_data[$id]->geo->longitude = esc_js($lng);
}
return $venue_data;
}
示例5: tribe_get_end_date
/**
* End Date
*
* Returns the event end date
*
* @param int $postId (optional) this only works for non recurring events
* @param bool $displayTime If true shows date and time, if false only shows date
* @param string $dateFormat Allows date and time formating using standard php syntax (http://php.net/manual/en/function.date.php)
* @return string Date
* @todo support $postId for recurring events.
* @since 2.0
*/
function tribe_get_end_date($postId = null, $displayTime = 'true', $dateFormat = '')
{
$postId = TribeEvents::postIdHelper($postId);
if (!$postId || function_exists('tribe_is_recurring_event') && tribe_is_recurring_event($postId)) {
global $post;
} else {
$post = get_post($postId);
}
if (tribe_get_all_day($postId)) {
$displayTime = false;
}
if (empty($post->EventEndDate)) {
$post->EventEndDate = tribe_get_event_meta($postId, '_EventEndDate', true);
}
if (isset($post->EventEndDate)) {
$date = strtotime($post->EventEndDate);
} else {
return;
// '—';
}
return tribe_event_format_date($date, $displayTime, $dateFormat);
}
示例6: tribe_get_end_date
/**
* End Date
*
* Returns the event end date
*
* @param int $event (optional) this only works for non recurring events
* @param bool $displayTime If true shows date and time, if false only shows date
* @param string $dateFormat Allows date and time formating using standard php syntax (http://php.net/manual/en/function.date.php)
* @return string Date
* @todo support $postId for recurring events.
* @since 2.0
*/
function tribe_get_end_date($event = null, $displayTime = true, $dateFormat = '')
{
if (is_null($event)) {
global $post;
$event = $post;
}
if (is_numeric($event)) {
$event = get_post($event);
}
if (tribe_event_is_all_day($event)) {
$displayTime = false;
}
if (empty($event->EventEndDate) && is_object($event)) {
$event->EventEndDate = tribe_get_event_meta($event->ID, '_EventEndDate', true);
}
if (isset($event->EventEndDate)) {
$date = strtotime($event->EventEndDate);
} else {
return;
// '—';
}
return tribe_event_format_date($date, $displayTime, $dateFormat);
}
示例7: tribe_get_organizer_phone
/**
* Organizer Phone
*
* Returns the event Organizer's phone number
*
* @param int $postId Can supply either event id or organizer id, if none specified, current post is used
* @return string Organizer's Phone Number
* @since 2.0
*/
function tribe_get_organizer_phone($postId = null)
{
$postId = TribeEvents::postIdHelper($postId);
$output = esc_html(tribe_get_event_meta(tribe_get_organizer_id($postId), '_OrganizerPhone', true));
return apply_filters('tribe_get_organizer_phone', $output);
}
示例8: tribe_get_cost
/**
* Get an event's cost
*
*
* @param null|int $postId (optional)
* @param bool $withCurrencySymbol Include the currency symbol
* @return string Cost of the event.
*/
function tribe_get_cost($postId = null, $withCurrencySymbol = false)
{
$tribe_ecp = TribeEvents::instance();
$postId = TribeEvents::postIdHelper($postId);
$cost = tribe_get_event_meta($postId, '_EventCost', true);
if ($cost === '') {
$cost = '';
} elseif ($cost === '0') {
$cost = __("Free", 'tribe-events-calendar');
} else {
$cost = esc_html($cost);
}
if ($withCurrencySymbol && is_numeric($cost)) {
$currency = tribe_get_event_meta($postId, '_EventCurrencySymbol', true);
if (!$currency) {
$currency = tribe_get_option('defaultCurrencySymbol', '$');
}
$cost = $currency . $cost;
}
return apply_filters('tribe_get_cost', $cost, $postId, $withCurrencySymbol);
}
示例9: tribe_events_template_data
/**
* Returns json for javascript templating functions throughout the plugin.
*
* @param $event
* @param $additional
*
* @return string
*/
function tribe_events_template_data($event, array $additional = null)
{
$has_image = false;
$start_time = '';
$end_time = '';
$image_src = '';
$image_tool_src = '';
// @TODO use tribe_events_event_schedule_details()
$date_format = tribe_get_date_format(true);
$time_format = get_option('time_format', TribeDateUtils::TIMEFORMAT);
$date_time_separator = tribe_get_option('dateTimeSeparator', ' @ ');
if (!empty($event->EventStartDate)) {
$start_time .= date_i18n($date_format, strtotime($event->EventStartDate));
}
if (!tribe_get_event_meta($event->ID, '_EventAllDay', true)) {
$start_time .= $date_time_separator . date_i18n($time_format, strtotime($event->EventStartDate));
}
if (!empty($event->EventEndDate) && $event->EventStartDate !== $event->EventEndDate) {
if (date('Y-m-d', strtotime($event->EventStartDate)) == date('Y-m-d', strtotime($event->EventEndDate))) {
if (!tribe_get_event_meta($event->ID, '_EventAllDay', true)) {
$end_time .= date_i18n($time_format, strtotime($event->EventEndDate));
}
} else {
$end_time .= date_i18n($date_format, strtotime($event->EventEndDate));
if (!tribe_get_event_meta($event->ID, '_EventAllDay', true)) {
$end_time .= $date_time_separator . date_i18n($time_format, strtotime($event->EventEndDate));
}
}
}
if (function_exists('has_post_thumbnail') && has_post_thumbnail($event->ID)) {
$has_image = true;
$image_arr = wp_get_attachment_image_src(get_post_thumbnail_id($event->ID), 'medium');
$image_src = $image_arr[0];
}
if ($has_image) {
$image_tool_arr = wp_get_attachment_image_src(get_post_thumbnail_id($event->ID), array(75, 75));
$image_tool_src = $image_tool_arr[0];
}
if (has_excerpt($event->ID)) {
$excerpt = $event->post_excerpt;
} else {
$excerpt = $event->post_content;
}
$excerpt = TribeEvents::instance()->truncate($excerpt, 30);
$category_classes = tribe_events_event_classes($event->ID, false);
$json = array('eventId' => $event->ID, 'title' => $event->post_title, 'permalink' => tribe_get_event_link($event->ID), 'imageSrc' => $image_src, 'startTime' => $start_time, 'endTime' => $end_time, 'imageTooltipSrc' => $image_tool_src, 'excerpt' => $excerpt, 'categoryClasses' => $category_classes);
if ($additional) {
$json = array_merge((array) $json, (array) $additional);
}
$json = apply_filters('tribe_events_template_data_array', $json, $event, $additional);
$json = tribe_prepare_for_json_deep($json);
return json_encode($json);
}
示例10: getEventMeta
/**
* @deprecated
*/
function getEventMeta($id, $meta, $single = true)
{
_deprecated_function(__FUNCTION__, '2.0', 'tribe_get_event_meta()');
return tribe_get_event_meta($id, $meta, $single);
}
示例11: dt_sc_events
function dt_sc_events($atts, $content = null)
{
if (!function_exists('dt_events_list') && dttheme_is_plugin_active('the-events-calendar/the-events-calendar.php')) {
extract(shortcode_atts(array('limit' => '-1', 'carousel' => ''), $atts));
global $post;
$out = '';
$firstcnt = 2;
$post_thumbnail = 'blogcourse-three-column';
$tpl_default_settings = get_post_meta(get_the_ID(), '_tpl_default_settings', TRUE);
$tpl_default_settings = is_array($tpl_default_settings) ? $tpl_default_settings : array();
$page_layout = array_key_exists("layout", $tpl_default_settings) ? $tpl_default_settings['layout'] : "content-full-width";
if ($page_layout == 'with-left-sidebar' || $page_layout == 'with-right-sidebar') {
$post_thumbnail .= '-single-sidebar';
} elseif ($page_layout == 'both-sidebar') {
$post_thumbnail .= '-both-sidebar';
}
if ($carousel == 'true') {
$html_tag = 'li';
} else {
$html_tag = 'div';
}
$all_events = tribe_get_events(array('eventDisplay' => 'all', 'posts_per_page' => $limit));
$cnt = 0;
foreach ($all_events as $post) {
setup_postdata($post);
$temp_class = $firstcls = '';
if ($carousel != 'true') {
$no = $cnt + 1;
if ($no % $firstcnt == 1) {
$firstcls = ' first';
}
}
$out .= '<' . $html_tag . ' class="dt-sc-one-half column ' . $firstcls . '" id="post-' . get_the_ID() . '">';
$out .= '<div class="dt-sc-event-container">';
$out .= '<div class="dt-sc-event-thumb">';
$out .= '<a href="' . get_permalink() . '" title="' . get_the_title() . '">';
if (has_post_thumbnail()) {
$attr = array('title' => get_the_title());
$out .= get_the_post_thumbnail($post->ID, $post_thumbnail, $attr);
} else {
$out .= '<img src="http://placehold.it/1170x895&text=Image" alt="' . get_the_title() . '" />';
}
$out .= '</a>';
if (tribe_get_cost($post->ID) != '') {
$currency_symbol = tribe_get_event_meta($post->ID, '_EventCurrencySymbol', true);
if (!$currency_symbol) {
$currency_symbol = tribe_get_option('defaultCurrencySymbol', '$');
}
$currency_position = tribe_get_event_meta($post->ID, '_EventCurrencyPosition', true);
$out .= '<span class="event-price">';
if ($currency_position == 'suffix') {
$out .= tribe_get_cost($post->ID) . $currency_symbol;
} else {
$out .= $currency_symbol . tribe_get_cost($post->ID);
}
$out .= '</span>';
}
$out .= '</div>';
$out .= '<div class="dt-sc-event-content">';
$out .= '<h2><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>';
$out .= '<div class="dt-sc-event-meta">';
$out .= '<p> <i class="fa fa-calendar-o"> </i>' . tribe_get_start_date($post->ID, false, 'M Y @ h a') . ' - ' . tribe_get_end_date($post->ID, false, 'M Y @ h a') . ' </p>';
$venue_id = tribe_get_venue_id($post->ID);
if (isset($venue_id) && $venue_id > 0) {
$url = esc_url(get_permalink($venue_id));
$venue_name = tribe_get_venue($post->ID);
$out .= '<p> <i class="fa fa-map-marker"> </i>';
$out .= '<a href="' . $url . '">' . $venue_name . '</a>';
$out .= ', ' . tribe_get_country($post->ID);
if (tribe_get_map_link() != '') {
$out .= '<a href="' . tribe_get_map_link() . '" title="' . $venue_name . '" target="_blank">' . __(' + Google Map ', 'dt_themes') . '</a>';
}
$out .= '</p>';
}
$out .= '</div>';
$out .= '</div>';
$out .= '</div>';
$out .= '</' . $html_tag . '>';
$cnt++;
}
if ($carousel == 'true') {
return '<div class="dt-sc-events-carousel-wrapper"><ul class="dt-sc-events-carousel">' . $out . '</ul><div class="carousel-arrows"><a class="events-prev" href=""></a><a class="events-next" href=""></a></div></div>';
} else {
return $out;
}
} else {
return '';
}
}
示例12: tribe_get_event_website_url
/**
* Event Website URL
*
* @param null|object|int $event
* @return string The event's website URL
*/
function tribe_get_event_website_url($event = null)
{
$post_id = is_object($event) && isset($event->tribe_is_event) && $event->tribe_is_event ? $event->ID : $event;
$post_id = !empty($post_id) || empty($GLOBALS['post']) ? $post_id : get_the_ID();
$url = tribe_get_event_meta($post_id, '_EventURL', true);
if (!empty($url)) {
$parseUrl = parse_url($url);
if (empty($parseUrl['scheme'])) {
$url = "http://{$url}";
}
}
return apply_filters('tribe_get_event_website_url', $url, $post_id);
}
示例13: tribe_get_venue_website_url
/**
* Returns the venue website URL related to the current post or for the optionally
* specified post.
*
* @param int|null $post_id
*
* @return string
*/
function tribe_get_venue_website_url($post_id = null)
{
return (string) tribe_get_event_meta(tribe_get_venue_id($post_id), '_VenueURL', true);
}
示例14: tribe_format_currency
/**
* Receives a float and formats it with a currency symbol
*
* @category Cost
* @param string $cost pricing to format
* @param null|int $postId
* @param null|string $currency_symbol
* @param null|bool $reverse_position
*
* @return string
*/
function tribe_format_currency($cost, $postId = null, $currency_symbol = null, $reverse_position = null)
{
$postId = Tribe__Events__Main::postIdHelper($postId);
// if no currency symbol was passed, and we're looking at a particular event,
// let's check if there was a currency symbol set on that event
if ($postId && $currency_symbol == null) {
$currency_symbol = tribe_get_event_meta($postId, '_EventCurrencySymbol', true);
}
// if no currency symbol was passed, or we're not looking at a particular event,
// let's get the default currency symbol
if (!$postId || !$currency_symbol) {
$currency_symbol = tribe_get_option('defaultCurrencySymbol', '$');
}
if ($postId && $reverse_position == null) {
$reverse_position = tribe_get_event_meta($postId, '_EventCurrencyPosition', true);
$reverse_position = 'suffix' === $reverse_position;
}
if (!$reverse_position || !$postId) {
$reverse_position = tribe_get_option('reverseCurrencyPosition', false);
}
$cost = $reverse_position ? $cost . $currency_symbol : $currency_symbol . $cost;
return $cost;
}
示例15: tribe_get_organizer_website_link
/**
* Organizer website link
*
* Returns the event Organizer Name with a link to their supplied website
*
* @param $post_id post ID for an event
* @param $label text for the link
*
* @return string
**/
function tribe_get_organizer_website_link($post_id = null, $label = null)
{
$post_id = tribe_get_organizer_id($post_id);
$url = tribe_get_event_meta($post_id, '_OrganizerWebsite', true);
if (!empty($url)) {
$label = is_null($label) ? $url : $label;
if (!empty($url)) {
$parseUrl = parse_url($url);
if (empty($parseUrl['scheme'])) {
$url = "http://{$url}";
}
}
$html = sprintf('<a href="%s" target="%s">%s</a>', esc_url($url), apply_filters('tribe_get_organizer_website_link_target', '_self'), apply_filters('tribe_get_organizer_website_link_label', $label));
} else {
$html = '';
}
return apply_filters('tribe_get_organizer_website_link', $html);
}