本文整理汇总了PHP中tribe_get_start_date函数的典型用法代码示例。如果您正苦于以下问题:PHP tribe_get_start_date函数的具体用法?PHP tribe_get_start_date怎么用?PHP tribe_get_start_date使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tribe_get_start_date函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
}
开发者ID:nikolaror,项目名称:Bodega,代码行数:30,代码来源:functions-bkp.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);
}
开发者ID:TravisSperry,项目名称:mpa_website,代码行数:11,代码来源:Event_Countdown.php
示例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);
}
开发者ID:jvcanote,项目名称:wp-the-events-calendar,代码行数:36,代码来源:meta.php
示例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;
}
开发者ID:chicosilva,项目名称:olharambiental,代码行数:36,代码来源:Google_Data_Markup.php
示例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]";
}
}
开发者ID:csteines,项目名称:Complete-Training-Plugin,代码行数:12,代码来源:shortcode-functions.php
示例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;
}
开发者ID:reubenbrown13,项目名称:the-events-calendar,代码行数:19,代码来源:Timezones.php
示例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();
}
}
开发者ID:rlaloux,项目名称:tribe-events-agenda-view,代码行数:16,代码来源:tribe-events-agenda-template-class.php
示例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();
}
开发者ID:m-godefroid76,项目名称:devrestofactory,代码行数:55,代码来源:upcoming-events.php
示例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);
}
开发者ID:michael-pratt,项目名称:event-rocket,代码行数:11,代码来源:event-duplicator-filters.php
示例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);
}
开发者ID:TyRichards,项目名称:river_of_life,代码行数:18,代码来源:meta.php
示例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);
}
开发者ID:michael-pratt,项目名称:event-rocket,代码行数:23,代码来源:helpers.php
示例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;
}
开发者ID:simple-beck,项目名称:project-gc,代码行数:15,代码来源:Countdown_Widget.php
示例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;
}
开发者ID:bostondv,项目名称:the-events-calendar,代码行数:19,代码来源:Event.php
示例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>
';
}
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:26,代码来源:Attendees_Report.php
示例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);
}
}
开发者ID:partisan-collective,项目名称:partisan,代码行数:32,代码来源:Known_Range.php
示例16: get_data
/**
* Fetches the JSON-LD data for this type of object
*
* @param int|WP_Post|null $post The post/event
* @param array $args
* @return array
*/
public function get_data($posts = null, $args = array())
{
$posts = $posts instanceof WP_Post ? array($posts) : (array) $posts;
$return = array();
foreach ($posts as $i => $post) {
$data = parent::get_data($post, $args);
// If we have an Empty data we just skip
if (empty($data)) {
continue;
}
// Fetch first key
$post_id = key($data);
// Fetch first Value
$data = reset($data);
$event_tz_string = get_post_meta($post_id, '_EventTimezone', true);
$tz_mode = tribe_get_option('tribe_events_timezone_mode', 'event');
$tz_string = $event_tz_string && $tz_mode === 'event' ? $event_tz_string : Tribe__Events__Timezones::wp_timezone_string();
$data->startDate = Tribe__Events__Timezones::to_utc(tribe_get_start_date($post_id, true, Tribe__Date_Utils::DBDATETIMEFORMAT), $tz_string, 'c');
$data->endDate = Tribe__Events__Timezones::to_utc(tribe_get_end_date($post_id, true, Tribe__Date_Utils::DBDATETIMEFORMAT), $tz_string, 'c');
if (tribe_has_venue($post_id)) {
$venue_id = tribe_get_venue_id($post_id);
$venue_data = Tribe__Events__JSON_LD__Venue::instance()->get_data($venue_id);
$data->location = reset($venue_data);
}
if (tribe_has_organizer($post_id)) {
$organizer_id = tribe_get_organizer_id($post_id);
$organizer_data = Tribe__Events__JSON_LD__Organizer::instance()->get_data($organizer_id);
$data->organizer = reset($organizer_data);
}
$price = tribe_get_cost($post_id);
$price = $this->normalize_price($price);
if ('' !== $price) {
// Manually Include the Price for non Event Tickets
$data->offers = (object) array('@type' => 'Offer', 'price' => $price, 'url' => $data->url);
}
$return[$post_id] = $data;
}
return $return;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:46,代码来源:Event.php
示例17: add_date_to_events_calendar
function add_date_to_events_calendar($html)
{
$html = '';
global $post, $wp_query;
$event_year = tribe_get_start_date($post, false, 'Y');
$event_month = tribe_get_start_date($post, false, 'm');
$event_day = tribe_get_start_date($post, false, 'j');
if ($wp_query->current_post > 0) {
$prev_post = $wp_query->posts[$wp_query->current_post - 1];
$prev_event_year = tribe_get_start_date($prev_post, false, 'Y');
$prev_event_month = tribe_get_start_date($prev_post, false, 'm');
$prev_event_day = tribe_get_start_date($prev_post, false, 'j');
}
/*
* If the event month changed since the last event in the loop,
* or is the same month but the year changed.
*
*/
if ($wp_query->current_post === 0 || ($prev_event_month != $event_month || $prev_event_month == $event_month && $prev_event_year != $event_year)) {
$html .= sprintf("<div class='tribe-events-list-separator-month'><span>%s</span></div>", tribe_get_start_date($post, false, 'F Y'));
}
/*
* If this event year is different to the year of the previous event in the loop,
* and it’s not it’s not the first event in the loop (we don’t want to start the loop with a year separator)
*/
if ($wp_query->current_post > 0 && $prev_event_year != $event_year) {
$html .= sprintf("<span class='tribe-events-list-separator-year'>%s</span>", $event_year);
}
/*
* If the event day changed since the last event in the loop,
* or is the same day but the month changed.
*
*/
if ($wp_query->current_post === 0 || ($prev_event_day != $event_day || $prev_event_day == $event_day && $prev_event_month != $event_month)) {
$html .= sprintf("<div class='tribe-events-list-separator-month'><span>%s</span></div>", tribe_get_start_date($post, false, 'F j (l)'));
}
return $html;
}
开发者ID:CityOfPrescott,项目名称:sandbox_tabula-rasa,代码行数:38,代码来源:functions-tribe_events.php
示例18: maybe_render_multiple_formatted_times
/**
* Alters the provided formatted time to include all recurrence times for the day
*
* @since 4.0.3
*
* @param string $formatted_time Formatted time range for the given event
* @param int $event_id Event ID
*
* @return string
*/
public function maybe_render_multiple_formatted_times($formatted_time, $event_id)
{
if (!tribe_is_recurring_event($event_id)) {
return $formatted_time;
}
$date = tribe_get_start_date($event_id, false, Tribe__Date_Utils::DBDATEFORMAT);
$time_format = get_option('time_format', Tribe__Date_Utils::TIMEFORMAT);
$time_range_separator = tribe_get_option('timeRangeSeparator', ' - ');
$events = $this->get_recurring_events_for_date($event_id, $date);
$formatted_time = null;
foreach ($events as $child) {
$start_time = tribe_get_start_date($child->ID, false, $time_format);
$end_time = tribe_get_end_date($child->ID, false, $time_format);
$formatted_time .= '<div class="tribe-recurring-event-time">';
if ($start_time === $end_time) {
$formatted_time .= esc_html($start_time);
} else {
$formatted_time .= esc_html($start_time . $time_range_separator . $end_time);
}
$formatted_time .= '</div>';
}
return $formatted_time;
}
开发者ID:acutedeveloper,项目名称:havering-intranet-development,代码行数:33,代码来源:Single_Event_Overrides.php
示例19: setup_view
/**
* Organize and reorder the events posts according to time slot
*
* @return void
**/
public function setup_view()
{
global $wp_query;
$time_format = apply_filters('tribe_events_day_timeslot_format', get_option('time_format', TribeDateUtils::TIMEFORMAT));
if ($wp_query->have_posts()) {
$unsorted_posts = $wp_query->posts;
foreach ($unsorted_posts as &$post) {
if (tribe_event_is_all_day($post->ID)) {
$post->timeslot = __('All Day', 'tribe-events-calendar');
} else {
if (strtotime(tribe_get_start_date($post->ID, true, TribeDateUtils::DBDATETIMEFORMAT)) < strtotime($wp_query->get('start_date'))) {
$post->timeslot = __('Ongoing', 'tribe-events-calendar');
} else {
$post->timeslot = tribe_get_start_date($post, false, $time_format);
}
}
}
unset($post);
// Make sure All Day events come first
$all_day = array();
$ongoing = array();
$hourly = array();
foreach ($unsorted_posts as $i => $post) {
if ($post->timeslot == __('All Day', 'tribe-events-calendar')) {
$all_day[$i] = $post;
} else {
if ($post->timeslot == __('Ongoing', 'tribe-events-calendar')) {
$ongoing[$i] = $post;
} else {
$hourly[$i] = $post;
}
}
}
$wp_query->posts = array_values($all_day + $ongoing + $hourly);
$wp_query->rewind_posts();
}
}
开发者ID:estrategasdigitales,项目名称:Golone,代码行数:42,代码来源:day.php
示例20: setup_view
/**
* Organize and reorder the events posts according to time slot
*
* @return void
* @since 3.0
**/
public function setup_view()
{
global $wp_query;
$time_format = apply_filters('tribe_events_pro_day_timeslot_format', 'ga ');
if ($wp_query->have_posts()) {
$unsorted_posts = $wp_query->posts;
foreach ($unsorted_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, $time_format));
}
unset($post);
// Make sure All Day events come first
$all_day = array();
$hourly = array();
foreach ($unsorted_posts as $i => $post) {
if ($post->timeslot == __('All Day', 'tribe-events-calendar-pro')) {
$all_day[$i] = $post;
} else {
$hourly[$i] = $post;
}
}
$wp_query->posts = array_values($all_day + $hourly);
$wp_query->rewind_posts();
}
}
开发者ID:donwea,项目名称:nhap.org,代码行数:30,代码来源:day.php
注:本文中的tribe_get_start_date函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论