本文整理汇总了PHP中tribe_get_start_date函数的典型用法代码示例。如果您正苦于以下问题:PHP tribe_get_start_date函数的具体用法?PHP tribe_get_start_date怎么用?PHP tribe_get_start_date使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tribe_get_start_date函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tribe_rss_feed_add_eventdate
function tribe_rss_feed_add_eventdate()
{
?>
<ev:tribe_event_meta xmlns:ev="Event">
<?php
if (tribe_get_start_date() !== tribe_get_end_date()) {
?>
<ev:startdate><?php
echo tribe_get_start_date();
?>
</ev:startdate>
<ev:enddate><?php
echo tribe_get_end_date();
?>
</ev:enddate>
<?php
} else {
?>
<ev:startdate><?php
echo tribe_get_start_date();
?>
</ev:startdate>
<?php
}
?>
</ev:tribe_event_meta>
<?php
}
示例2: set_date
/**
* The countdown widget requires the date of the event to be passed in
* as an argument.
*/
protected function set_date()
{
if (!isset($this->arguments['event_ID'])) {
return;
}
$this->arguments['event_date'] = tribe_get_start_date($this->arguments['event_ID'], false, Tribe__Events__Date_Utils::DBDATEFORMAT);
}
示例3: event_date
/**
* Get the event date
*
* @param int $meta_id
* @return string
*/
public static function event_date($meta_id)
{
$time_format = get_option('time_format', TribeDateUtils::TIMEFORMAT);
$start_time = tribe_get_start_date(null, false, $time_format);
$end_time = tribe_get_end_date(null, false, $time_format);
if (tribe_event_is_all_day()) {
if (tribe_event_is_multiday()) {
$html = Tribe_Meta_Factory::template(__('Start:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr updated published dtstart" title="%s">%s</abbr>', tribe_get_start_date(null, false, TribeDateUtils::DBDATEFORMAT), tribe_get_start_date()), $meta_id);
$html .= Tribe_Meta_Factory::template(__('End:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr dtend" title="%s">%s</abbr>', tribe_get_end_date(null, false, TribeDateUtils::DBDATEFORMAT), tribe_get_end_date()), $meta_id);
} else {
// If all day event, show only start date
$html = Tribe_Meta_Factory::template(__('Date:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr updated published dtstart" title="%s">%s</abbr>', tribe_get_start_date(null, false, TribeDateUtils::DBDATEFORMAT), tribe_get_start_date()), $meta_id);
}
} elseif (tribe_event_is_multiday()) {
// If multiday, show start date+time and end date+time
$html = Tribe_Meta_Factory::template(__('Start:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr updated published dtstart" title="%s">%s</abbr>', tribe_get_start_date(null, false, TribeDateUtils::DBDATEFORMAT), tribe_get_start_date()), $meta_id);
$html .= Tribe_Meta_Factory::template(__('End:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr dtend" title="%s">%s</abbr>', tribe_get_end_date(null, false, TribeDateUtils::DBDATEFORMAT), tribe_get_end_date()), $meta_id);
} else {
// show start date
$html = Tribe_Meta_Factory::template(__('Date:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr updated published dtstart" title="%s">%s</abbr>', tribe_get_start_date(null, false, TribeDateUtils::DBDATEFORMAT), tribe_get_start_date(null, false)), $meta_id);
if ($start_time == $end_time) {
// if start and end time are the same, just show the start time
$html .= Tribe_Meta_Factory::template(__('Time:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr dtend" title="%s">%s</abbr>', tribe_get_end_date(null, false, TribeDateUtils::DBDATEFORMAT), $start_time), $meta_id);
} else {
// show start and end time
$html .= Tribe_Meta_Factory::template(__('Time:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr dtend" title="%s">%s</abbr>', tribe_get_end_date(null, false, TribeDateUtils::DBDATEFORMAT), $start_time . ' - ' . $end_time), $meta_id);
}
}
return apply_filters('tribe_event_meta_event_date', $html);
}
示例4: build_data
/**
* Compile the schema.org event data into an array
*/
private function build_data()
{
global $post;
$id = $post->ID;
$events_data = array();
// Index by ID: this will allow filter code to identify the actual event being referred to
// without injecting an additional property
$events_data[$id] = new stdClass();
$events_data[$id]->{'@context'} = 'http://schema.org';
$events_data[$id]->{'@type'} = 'Event';
$events_data[$id]->name = get_the_title();
if (has_post_thumbnail()) {
$events_data[$id]->image = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
}
$events_data[$id]->url = get_the_permalink($post->ID);
$events_data[$id]->startDate = get_gmt_from_date(tribe_get_start_date($post, true, TribeDateUtils::DBDATETIMEFORMAT), 'c');
$events_data[$id]->endDate = get_gmt_from_date(tribe_get_end_date($post, true, TribeDateUtils::DBDATETIMEFORMAT), 'c');
if (tribe_has_venue($id)) {
$events_data[$id]->location = new stdClass();
$events_data[$id]->location->{'@type'} = 'Place';
$events_data[$id]->location->name = tribe_get_venue($post->ID);
$events_data[$id]->location->address = strip_tags(str_replace("\n", '', tribe_get_full_address($post->ID)));
}
/**
* Allows the event data to be modifed by themes and other plugins.
*
* @param array $events_data objects representing the Google Markup for each event.
*/
$events_data = apply_filters('tribe_google_event_data', $events_data);
// Strip the post ID indexing before returning
$events_data = array_values($events_data);
return $events_data;
}
示例5: swsctp_course_date_time
/**
* Course Start Date & Time [start_date_time]
* @return MM/DD/YYYY @ HH:MM
*/
function swsctp_course_date_time()
{
if (tribe_get_start_date()) {
return tribe_get_start_date();
} else {
return "[class_start_date_time]";
}
}
示例6: get_event_timezone_abbr
/**
* Returns the event's timezone abbreviation if it can be determined, or else
* falls back on the full timezone string/offset text (again, if known - if it
* is not it will assume the global WP timezone setting).
*
* @param int|null $event_id
*
* @return string
*/
public static function get_event_timezone_abbr($event_id = null)
{
$abbr = get_post_meta($event_id, '_EventTimezoneAbbr', true);
if (empty($abbr)) {
$timezone_string = self::get_event_timezone_string($event_id);
$date = tribe_get_start_date($event_id, true, Tribe__Date_Utils::DBDATETIMEFORMAT);
$abbr = self::abbr($date, $timezone_string);
}
return empty($abbr) ? $timezone_string : $abbr;
}
示例7: setup_view
/**
* Organize and reorder the events posts according to time slot
*
* @return void
* @since 1.0
**/
public function setup_view()
{
global $wp_query;
if ($wp_query->have_posts()) {
foreach ($wp_query->posts as &$post) {
$post->timeslot = tribe_event_is_all_day($post->ID) ? __('All Day', 'tribe-events-calendar-pro') : ($post->timeslot = tribe_get_start_date($post, false, 'l, F jS Y g:i A'));
}
$wp_query->rewind_posts();
}
}
示例8: front_end
function front_end($args, $instance)
{
extract($args);
$limit = intval($instance['load']);
$title = $instance['title'];
$events = tribe_get_events(array('eventDisplay' => 'upcoming', 'posts_per_page' => $event_count));
if (!empty($events)) {
echo $title ? $before_title . $title . $after_title : '';
foreach ($events as $event) {
$start_date = strtotime(tribe_get_start_date($event->ID));
$start_date_day = date('Y-m-d', $start_date);
$end_date = strtotime(tribe_get_end_date($event->ID));
$end_date_day = date('Y-m-d', $end_date);
$all_day = tribe_event_is_all_day($event->ID);
$time_format = get_option('time_format');
if ($all_day) {
$date_format = date('F jS', $start_date) . '<span>•</span> <em>' . __('All day', 'espresso') . '</em>';
} else {
if ($end_date_day) {
if ($start_date_day == $end_date_day) {
$date_format = date('F jS', $start_date) . '<span>•</span> <em>' . date($time_format, $start_date) . ' – ' . date($time_format, $end_date) . '</em>';
} else {
$date_format = date('F jS', $start_date) . ' <em>@ ' . date($time_format, $start_date) . '<br />' . __('to', 'espresso') . '</em> ' . date('F jS', $end_date) . ' <em>@' . date($time_format, $end_date) . '</em>';
}
}
}
?>
<article class="upcoming-event-block clearfix">
<h3><a href="<?php
echo get_permalink($event->ID);
?>
"><?php
echo apply_filters('the_title', $event->post_title);
?>
</a></h3>
<small><?php
echo $date_format;
?>
</small>
<p><?php
echo $event->post_excerpt ? $event->post_excerpt : espressoTruncate($event->post_content, 155) . ' ...';
?>
</p>
<a class="es-button" href="<?php
echo get_permalink($event->ID);
?>
"><?php
_e('Event Information', 'espresso');
?>
</a>
</article><?php
}
}
wp_reset_query();
}
示例9: maintain_gap
protected function maintain_gap(array &$meta, $original)
{
// Original event start/end times and difference between them
$start = tribe_get_start_date($original->ID, false, Tribe__Events__Date_Utils::DBDATETIMEFORMAT);
$end = tribe_get_end_date($original->ID, false, Tribe__Events__Date_Utils::DBDATETIMEFORMAT);
$diff = strtotime($end) - strtotime($start);
// Adjust new event end time to maintain the same difference
$start = strtotime($meta['_EventStartDate']);
$end = $start + $diff;
$meta['_EventEndDate'] = date(Tribe__Events__Date_Utils::DBDATETIMEFORMAT, $end);
}
示例10: event_date
/**
* Get the event date
*
* @param int $meta_id
* @return string
*/
function event_date($meta_id)
{
if (tribe_get_start_date() !== tribe_get_end_date()) {
// Start & end date
$html = Tribe_Meta_Factory::template(__('Start:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr updated published dtstart" title="%s">%s</abbr>', tribe_get_start_date(null, false, TribeDateUtils::DBDATEFORMAT), tribe_get_start_date()), $meta_id);
$html .= Tribe_Meta_Factory::template(__('End:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr dtend" title="%s">%s</abbr>', tribe_get_end_date(null, false, TribeDateUtils::DBDATEFORMAT), tribe_get_end_date()), $meta_id);
} else {
// If all day event, show only start date
$html = Tribe_Meta_Factory::template(__('Date:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr updated published dtstart" title="%s">%s</abbr>', tribe_get_start_date(null, false, TribeDateUtils::DBDATEFORMAT), tribe_get_start_date()), $meta_id);
}
return apply_filters('tribe_event_meta_event_date', $html);
}
示例11: next_tagged_event
/**
* Returns the next event after the current or specified one that shares the
* specified tag, else returns boolean false if none can be found.
*
* @param mixed $tag
* @param int $event_id
* @return mixed bool|WP_Post
*/
function next_tagged_event($tag, $event_id = null)
{
$event_id = Tribe__Events__Main::postIdHelper($event_id);
$current_event = get_post($event_id);
if (null === $current_event) {
return false;
}
$current_date = tribe_get_start_date($current_event->ID, false, 'Y-m-d H:i:s');
$later = date('Y-m-d H:i:s', strtotime($current_date) + 1);
$next_event = event_embed()->obtain(array('tag' => $tag, 'event' => 0 - $current_event->ID, 'start' => $later, 'limit' => 1));
if (empty($next_event)) {
return false;
}
return array_shift($next_event);
}
示例12: get_output
public function get_output($event_ID, $complete, $show_seconds, $event_date = null)
{
$ret = $complete;
ob_start();
include Tribe__Events__Templates::getTemplateHierarchy('pro/widgets/countdown-widget');
$hourformat = ob_get_clean();
// Get the event start date.
$startdate = tribe_is_recurring_event($event_ID) ? $event_date . ' ' . tribe_get_start_date($event_ID, false, Tribe__Events__Date_Utils::DBTIMEFORMAT) : tribe_get_start_date($event_ID, false, Tribe__Events__Date_Utils::DBDATETIMEFORMAT);
// Get the number of seconds remaining until the date in question.
$seconds = strtotime($startdate) - current_time('timestamp');
if ($seconds > 0) {
$ret = $this->generate_countdown_output($seconds, $complete, $hourformat, $event_ID, $event_date);
}
return $ret;
}
示例13: build_data
/**
* Compile the schema.org event data into an array
*/
protected function build_data()
{
global $post;
$id = $post->ID;
$event_data = parent::build_data();
$event_data[$id]->{'@type'} = 'Event';
$event_data[$id]->startDate = get_gmt_from_date(tribe_get_start_date($post, true, Tribe__Events__Date_Utils::DBDATETIMEFORMAT), 'c');
$event_data[$id]->endDate = get_gmt_from_date(tribe_get_end_date($post, true, Tribe__Events__Date_Utils::DBDATETIMEFORMAT), 'c');
if (tribe_has_venue($id)) {
$event_data[$id]->location = new stdClass();
$event_data[$id]->location->{'@type'} = 'Place';
$event_data[$id]->location->name = tribe_get_venue($post->ID);
$event_data[$id]->location->address = strip_tags(str_replace("\n", '', tribe_get_full_address($post->ID)));
}
return $event_data;
}
示例14: event_details_top
/**
* Injects event meta data into the Attendees report
*
* @param int $event_id
*/
public function event_details_top($event_id)
{
$post_type = get_post_type($event_id);
if (Tribe__Events__Main::POSTTYPE === $post_type) {
echo '
<li>
<strong>' . esc_html__('Start Date:', 'the-events-calendar') . '</strong>
' . tribe_get_start_date($event_id, false, tribe_get_date_format(true)) . '
</li>
';
}
if (tribe_has_venue($event_id)) {
$venue_id = tribe_get_venue_id($event_id);
echo '
<li class="venue-name">
<strong>' . tribe_get_venue_label_singular() . ': </strong>
<a href="' . get_edit_post_link($venue_id) . '" title="' . esc_html__('Edit Venue', 'the-events-calendar') . '">' . tribe_get_venue($event_id) . '</a>
</li>
';
}
}
示例15: update_known_range
/**
* Intelligently updates our record of the earliest start date/latest event date in
* the system. If the existing earliest/latest values have not been superseded by the new post's
* start/end date then no update takes place.
*
* This is deliberately hooked into save_post, rather than save_post_tribe_events, to avoid issues
* where the removal/restoration of hooks within addEventMeta() etc might stop this method from
* actually being called (relates to a core WP bug).
*
* @param int $event_id
*/
public function update_known_range($event_id)
{
$is_earliest_date_marker = in_array($event_id, tribe_get_option('earliest_date_markers', array()));
$is_latest_date_marker = in_array($event_id, tribe_get_option('latest_date_markers', array()));
if ($is_earliest_date_marker || $is_latest_date_marker) {
$this->rebuild_known_range();
return;
}
$current_min = tribe_events_earliest_date();
$current_max = tribe_events_latest_date();
$event_start = tribe_get_start_date($event_id, false, Tribe__Date_Utils::DBDATETIMEFORMAT);
$event_end = tribe_get_end_date($event_id, false, Tribe__Date_Utils::DBDATETIMEFORMAT);
if ($current_min > $event_start) {
$this->rebuild_known_range();
tribe_update_option('earliest_date', $event_start);
}
if ($current_max < $event_end) {
$this->rebuild_known_range();
tribe_update_option('latest_date', $event_end);
}
}