本文整理汇总了PHP中tribe_get_event_meta函数的典型用法代码示例。如果您正苦于以下问题:PHP tribe_get_event_meta函数的具体用法?PHP tribe_get_event_meta怎么用?PHP tribe_get_event_meta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tribe_get_event_meta函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:robertark,项目名称:the-events-calendar,代码行数:42,代码来源:date.php
示例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;
}
开发者ID:acutedeveloper,项目名称:havering-intranet-development,代码行数:14,代码来源:Organizer.php
示例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;
}
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:26,代码来源:Cost_Utils.php
示例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;
}
开发者ID:acutedeveloper,项目名称:havering-intranet-development,代码行数:22,代码来源:Venue.php
示例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);
}
开发者ID:mpaskew,项目名称:isc-dev,代码行数:34,代码来源:date.php
示例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);
}
开发者ID:scttrgd,项目名称:scottish-piping,代码行数:35,代码来源:date.php
示例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);
}
开发者ID:mpaskew,项目名称:isc-dev,代码行数:15,代码来源:organizer.php
示例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);
}
开发者ID:paarthd,项目名称:gslvpa,代码行数:29,代码来源:general.php
示例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);
}
开发者ID:chicosilva,项目名称:olharambiental,代码行数:61,代码来源:general.php
示例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);
}
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:8,代码来源:deprecated.php
示例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 '';
}
}
开发者ID:enlacee,项目名称:anb.platicom.com.pe,代码行数:89,代码来源:shortcodes.php
示例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);
}
开发者ID:estrategasdigitales,项目名称:Golone,代码行数:19,代码来源:link.php
示例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);
}
开发者ID:nullify005,项目名称:shcc-website,代码行数:12,代码来源:venue.php
示例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;
}
开发者ID:TMBR,项目名称:johnjohn,代码行数:34,代码来源:general.php
示例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);
}
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:28,代码来源:organizer.php
示例16: display_day
function display_day($day, $monthView)
{
global $post;
$output = '';
$posts_per_page = tribe_get_option('postsPerPage', 10);
for ($i = 0; $i < count($monthView[$day]); $i++) {
$post = $monthView[$day][$i];
setup_postdata($post);
$eventId = $post->ID . '-' . $day;
$start = tribe_get_start_date($post->ID, false, 'U');
$end = tribe_get_end_date($post->ID, false, 'U');
$cost = tribe_get_cost($post->ID);
?>
<div id='event_<?php
echo $eventId;
?>
' <?php
post_class('tribe-events-event tribe-events-real-event');
?>
>
<a href="<?php
tribe_event_link();
?>
"><?php
the_title();
?>
</a>
<div id='tooltip_<?php
echo $eventId;
?>
' class="tribe-events-tooltip" style="display:none;">
<h5 class="tribe-events-event-title"><?php
the_title();
?>
</h5>
<div class="tribe-events-event-body">
<div class="tribe-events-event-date">
<?php
if (!empty($start)) {
echo date_i18n(get_option('date_format', 'F j, Y'), $start);
}
if (!tribe_get_event_meta($post->ID, '_EventAllDay', true)) {
echo ' ' . date_i18n(get_option('time_format', 'g:i a'), $start);
}
?>
<?php
if (!empty($end) && $start !== $end) {
if (date_i18n('Y-m-d', $start) == date_i18n('Y-m-d', $end)) {
$time_format = get_option('time_format', 'g:i a');
if (!tribe_get_event_meta($post->ID, '_EventAllDay', true)) {
echo " – " . date_i18n($time_format, $end);
}
} else {
echo " – " . date_i18n(get_option('date_format', 'F j, Y'), $end);
if (!tribe_get_event_meta($post->ID, '_EventAllDay', true)) {
echo ' ' . date_i18n(get_option('time_format', 'g:i a'), $end) . '<br />';
}
}
}
?>
</div>
<?php
if (function_exists('has_post_thumbnail') && has_post_thumbnail()) {
?>
<div class="tribe-events-event-thumb"><?php
the_post_thumbnail(array(75, 75));
?>
</div>
<?php
}
?>
<?php
echo has_excerpt() ? TribeEvents::truncate($post->post_excerpt) : TribeEvents::truncate(get_the_content(), 30);
?>
</div>
<span class="tribe-events-arrow"></span>
</div>
</div>
<?php
if ($i < count($monthView[$day]) - 1) {
echo "<hr />";
}
}
}
开发者ID:EfncoPlugins,项目名称:the-events-calendar,代码行数:85,代码来源:table.php
示例17: tribe_get_cost
/**
* Event Cost
*
* If EventBrite plugin is active
* - If the event is registered in eventbrite, and has one ticket. Return the cost of that ticket.
* - If the event is registered in eventbrite, and there are many tickets, return "Varies"
* - If the event is not registered in eventbrite, and there is meta, return that.
* - If the event is not registered in eventbrite, and there is no meta, return ""
*
* @param int $postId (optional)
* @return string Cost of the event.
*/
function tribe_get_cost($postId = null)
{
$tribe_ecp = TribeEvents::instance();
$postId = TribeEvents::postIdHelper($postId);
if (class_exists('Eventbrite_for_TribeEvents')) {
global $spEventBrite;
$returned = $spEventBrite->tribe_get_cost($postId);
if ($returned) {
return apply_filters('tribe_get_cost', esc_html($returned));
}
}
$cost = tribe_get_event_meta($postId, '_EventCost', true);
if ($cost === '') {
$cost = '';
} elseif ($cost == '0') {
$cost = __("Free", 'tribe-events-calendar');
} else {
$cost = esc_html($cost);
}
return apply_filters('tribe_get_cost', $cost);
}
开发者ID:EfncoPlugins,项目名称:the-events-calendar,代码行数:33,代码来源:general.php
示例18: tribe_get_event_website_link
/**
* Event Website Link (more info)
*
* @param null|object|int $event
* @param null|string $label
* @return string $html
*/
function tribe_get_event_website_link($event = null, $label = null)
{
$post_id = is_object($event) && isset($event->tribe_is_event) && $event->tribe_is_event ? $event->ID : $event;
$post_id = !empty($post_id) ? $post_id : get_the_ID();
$url = tribe_get_event_meta($post_id, '_EventURL', 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>', $url, apply_filters('tribe_get_event_website_link_target', 'self'), apply_filters('tribe_get_event_website_link_label', $label));
} else {
$html = '';
}
return apply_filters('tribe_get_event_website_link', $html);
}
开发者ID:TyRichards,项目名称:river_of_life,代码行数:26,代码来源:link.php
示例19: tribe_events_template_data
/**
* Returns json for javascript templating functions throughout the plugin.
*
* @since 3.3
* @param $event
* @param $additional
* @author Modern Tribe
* @return string
*/
function tribe_events_template_data($event, array $additional = null)
{
$has_image = false;
$start_time = '';
$end_time = '';
$image_src = '';
$image_tool_src = '';
if (!empty($event->EventStartDate)) {
$start_time .= date_i18n(get_option('date_format', 'F j, Y'), strtotime($event->EventStartDate));
}
if (!tribe_get_event_meta($event->ID, '_EventAllDay', true)) {
$start_time .= ' ' . date_i18n(get_option('time_format', 'g:i a'), 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))) {
$time_format = get_option('time_format', 'g:i a');
if (!tribe_get_event_meta($event->ID, '_EventAllDay', true)) {
$end_time .= date_i18n($time_format, strtotime($event->EventEndDate));
}
} else {
$end_time .= date_i18n(get_option('date_format', 'F j, Y'), strtotime($event->EventEndDate));
if (!tribe_get_event_meta($event->ID, '_EventAllDay', true)) {
$end_time .= ' ' . date_i18n(get_option('time_format', 'g:i a'), 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 = tribe_prepare_for_json(TribeEvents::instance()->truncate($excerpt, 30));
$json = array('eventId' => $event->ID, 'title' => tribe_prepare_for_json($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);
if ($additional) {
$additional = array_map('tribe_prepare_for_json', $additional);
$json = array_merge((array) $json, (array) $additional);
}
return json_encode($json);
}
开发者ID:donwea,项目名称:nhap.org,代码行数:57,代码来源:general.php
示例20: tribe_get_phone
/**
* Venue Phone Number
*
* Returns the venue phone number
*
* @param int $postId Can supply either event id or venue id, if none specified, current post is used
* @return string Phone number
* @since 2.0
*/
function tribe_get_phone($postId = null)
{
$postId = tribe_get_venue_id($postId);
$output = esc_html(tribe_get_event_meta($postId, '_VenuePhone', true));
return $output;
}
开发者ID:mpaskew,项目名称:isc-dev,代码行数:15,代码来源:venue.php
注:本文中的tribe_get_event_meta函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论