本文整理汇总了PHP中eo_get_the_start函数的典型用法代码示例。如果您正苦于以下问题:PHP eo_get_the_start函数的具体用法?PHP eo_get_the_start怎么用?PHP eo_get_the_start使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eo_get_the_start函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testAddToGoogleLink
/**
* Test that using eo_get_add_to_google_link() does not reset timezone of
* start/end date of event
* @see https://wordpress.org/support/topic/eo_get_add_to_google_link?replies=1
*/
public function testAddToGoogleLink()
{
$tz = ini_get('date.timezone');
$original_tz = get_option('timezone_string');
$original_offset = get_option('gmt_offset');
update_option('timezone_string', '');
update_option('gmt_offset', 10);
$event_id = $this->factory->event->create(array('start' => new DateTime('2014-07-09 13:02:00', eo_get_blog_timezone()), 'end' => new DateTime('2014-07-09 14:02:00', eo_get_blog_timezone()), 'all_day' => 0, 'schedule' => 'once'));
$occurrences = eo_get_the_occurrences($event_id);
$occurrence_ids = array_keys($occurrences);
$occurrence_id = array_shift($occurrence_ids);
$actual = eo_get_the_start('Y-m-d H:i:s', $event_id, null, $occurrence_id);
$this->assertEquals('2014-07-09 13:02:00', $actual);
eo_get_add_to_google_link($event_id, $occurrence_id);
$actual = eo_get_the_start('Y-m-d H:i:s', $event_id, null, $occurrence_id);
$this->assertEquals('2014-07-09 13:02:00', $actual);
update_option('timezone_string', $original_tz);
update_option('gmt_offset', $original_offset);
}
开发者ID:Borgoroth,项目名称:Event-Organiser,代码行数:24,代码来源:eventFunctionsTest.php
示例2: testSeriesQuery
/**
* When grouping events by series, the plug-in should use the first date
* (chronologicaly) of the series, matching the query
*/
public function testSeriesQuery()
{
$events = eo_get_events(array('event_start_after' => '2015-03-01 00:00:00', 'showpastevents' => true, 'group_events_by' => 'series'));
$actual = array();
foreach ($events as $event) {
$actual[] = eo_get_the_start(DATETIMEOBJ, $event->ID, null, $event->occurrence_id);
}
$expected = array(new DateTime('2015-03-02 14:00:00', eo_get_blog_timezone()), new DateTime('2015-03-20 19:30:00', eo_get_blog_timezone()), new DateTime('2015-03-23 09:45:00', eo_get_blog_timezone()));
$this->assertEquals($expected, $actual);
foreach ($this->event_ids as $event_id) {
//var_dump( eo_get_the_occurrences( $event_id ) );
}
$events = eo_get_events(array('event_start_after' => '2015-03-22 00:00:00', 'showpastevents' => true, 'group_events_by' => 'series'));
$actual = array();
foreach ($events as $event) {
$actual[] = eo_get_the_start(DATETIMEOBJ, $event->ID, null, $event->occurrence_id);
}
$expected = array(new DateTime('2015-03-22 19:30:00', eo_get_blog_timezone()), new DateTime('2015-03-23 09:45:00', eo_get_blog_timezone()), new DateTime('2015-03-23 14:00:00', eo_get_blog_timezone()));
$this->assertEquals($expected, $actual);
}
开发者ID:hmorv,项目名称:Event-Organiser,代码行数:24,代码来源:eventQueryTest.php
示例3: getWorshipListings
function getWorshipListings($numberOfListings)
{
//html
global $post;
add_image_size('worship_widget_size', 85, 45, false);
$listings = new WP_Query(array('post_type' => 'event', 'posts_per_page' => $numberOfListings, 'event-category' => 'worship', 'event_start_after' => 'now', 'orderby' => 'eventstart', 'order' => 'ASC'));
if ($listings->found_posts > 0) {
echo '<ul class="rcumc_widget_entry">';
while ($listings->have_posts()) {
$listings->the_post();
$listItem = '<ul>';
if (has_post_thumbnail()) {
$image = get_the_post_thumbnail($post->ID, 'worship_widget_size');
$listItem .= $image;
}
$format = 'F j, g:i a';
$date = eo_get_the_start('n/j/y g:i a');
echo '<h2>' . $date . '</h2>';
$listItem .= ' <a href="' . get_permalink() . '">';
$listItem .= get_the_title() . ' </a></ul>';
echo $listItem;
if ($liturgical_info = get_the_term_list($post->ID, 'liturgical_info', '', __(', ', 'exodus'))) {
echo "<ul> {$liturgical_info} </ul>";
}
if ($musicians = get_the_term_list($post->ID, 'musicians', 'Music: ', __(', ', 'exodus'))) {
echo "<ul> {$musicians} </ul>";
}
$content = get_the_content();
echo '<ul class=worship_content>' . $content . '</ul><br/>';
}
echo '</ul>';
wp_reset_postdata();
} else {
echo '<p style="padding:25px;">No listing found</p>';
}
}
开发者ID:sflebrun,项目名称:rcumc-website,代码行数:36,代码来源:functions.php
示例4: eo_get_events
<?php
$events = eo_get_events(array('event_start_after' => 'today', 'showpastevents' => true));
if ($events) {
echo '<div class="news alt-color"><h2 class="category-headline alt-color">Upcoming</h2>';
foreach ($events as $event) {
//Check if all day, set format accordingly
$format = eo_is_all_day($event->ID) ? get_option('date_format') : get_option('date_format') . ' ' . get_option('time_format');
printf('<h3 class="news-title"><a href="%s"> %s </a></h3> <p> %s </p>', get_permalink($event->ID), get_the_title($event->ID), eo_get_the_start($format, $event->ID, null, $event->occurrence_id));
}
echo '</div>';
}
开发者ID:cmd1209,项目名称:EHM-2016,代码行数:12,代码来源:program-upcoming.php
示例5: eo_get_the_start
$cal_time = eo_get_the_start($tnum) . ' - ' . eo_get_the_end($tnum);
}
?>
<div class="cal-entry" >
<div class="date-box">
<span class="dname"><?php
echo eo_get_the_start($dName);
?>
</span>
<span class="dnum"><?php
echo eo_get_the_start($dNum);
?>
</span>
<span class="mname"><?php
echo eo_get_the_start($mName);
?>
</span>
</div>
<div class="img-box"><?php
the_post_thumbnail('feed-size');
?>
</div>
<div class="title-box">
<h4><?php
the_title();
?>
</h4>
<span><?php
echo $cal_time;
?>
开发者ID:JeppeSigaard,项目名称:ktf,代码行数:31,代码来源:shortcode-event-list.php
示例6: the_post_thumbnail
if (has_post_thumbnail()) {
// check if the event has a thumbnail assigned to it.
the_post_thumbnail(array(80, 80));
}
?>
<a href="<?php
the_permalink();
?>
" title="<?php
the_title_attribute();
?>
" ><?php
the_title();
?>
</a> <br/><?php
echo eo_get_the_start($format);
?>
</ul><br/>
<?php
}
?>
</ul>
<?php
} elseif (!empty($eo_event_loop_args['no_events'])) {
?>
<ul id="<?php
echo esc_attr($id);
开发者ID:sflebrun,项目名称:rcumc-website,代码行数:31,代码来源:widget-event-list.php
示例7: the_excerpt
?>
<p class="news-text"><?php
the_excerpt();
?>
</p>
<br class="clear">
</article>
<?php
// your other template tags
?>
<?php
$prev_month = eo_get_the_start('F');
$prev_year = eo_get_the_start('Y');
}
?>
</div>
<aside class="sidebar col col--3-of-12" role="complementary">
<?php
get_sidebar();
?>
</aside>
<?php
}
}
开发者ID:cmd1209,项目名称:EHM-2016,代码行数:31,代码来源:events.php
示例8: eventorganiser_delete_expired_events
/**
* Callback for the delete expired events cron job. Deletes events that finished at least 24 hours ago.
* For recurring events it is only deleted once the last occurrence has expired.
*
* @since 1.4.0
* @ignore
* @access private
*/
function eventorganiser_delete_expired_events()
{
//Get expired events
$events = eo_get_events(array('showrepeats' => 0, 'showpastevents' => 1, 'eo_interval' => 'expired'));
$time_until_expired = (int) apply_filters('eventorganiser_events_expire_time', 24 * 60 * 60);
$time_until_expired = max($time_until_expired, 0);
if ($events) {
$now = new DateTime('now', eo_get_blog_timezone());
foreach ($events as $event) {
$start = eo_get_the_start(DATETIMEOBJ, $event->ID, null, $event->occurrence_id);
$end = eo_get_the_end(DATETIMEOBJ, $event->ID, null, $event->occurrence_id);
$expired = round(abs($end->format('U') - $start->format('U'))) + $time_until_expired;
//Duration + expire time
$finished = eo_get_schedule_last(DATETIMEOBJ, $event->ID);
$finished->modify("+{$expired} seconds");
//[Expired time] after the last occurrence finishes
//Delete if [expired time] has passed
if ($finished <= $now) {
wp_trash_post((int) $event->ID);
}
}
}
}
开发者ID:windyjonas,项目名称:fredrika,代码行数:31,代码来源:event-organiser-register.php
示例9: while
<?php
if (have_posts()) {
while (have_posts()) {
the_post();
?>
<article id="post-<?php
the_ID();
?>
" <?php
post_class();
?>
>
<span class="news-date"><?php
printf(eo_get_the_start("G:i"));
?>
- <?php
printf(eo_get_the_end("G:i"));
?>
</span>
<?php
if (has_post_thumbnail()) {
?>
<?php
$thumb = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'medium');
?>
<div style="background:url('<?php
echo $thumb['0'];
?>
')no-repeat center center;" class="news-thumbnail"></div>
开发者ID:cmd1209,项目名称:EHM-2016,代码行数:31,代码来源:program-single-day.php
示例10: eo_has_event_started
function eo_has_event_started($id = '', $occurrence = 0)
{
$tz = eo_get_blog_timezone();
$start = new DateTime(eo_get_the_start('d-m-Y H:i', $id, $occurrence), $tz);
$now = new DateTime('now', $tz);
return $start <= $now;
}
开发者ID:rashadrussell,项目名称:UIUC_WebMonkeys_Website,代码行数:7,代码来源:event-organiser-event-functions.php
示例11: get_all_dates
/**
* Get all Event Organiser dates for a given post ID
*
* @since 0.1
*
* @param int $post_id The numeric ID of the WP post
* @return array $all_dates All dates for the post
*/
public function get_all_dates($post_id)
{
// init dates
$all_dates = array();
// get all dates
$all_event_dates = new WP_Query(array('post_type' => 'event', 'posts_per_page' => -1, 'event_series' => $post_id, 'group_events_by' => 'occurrence'));
// if we have some
if ($all_event_dates->have_posts()) {
// loop through them
while ($all_event_dates->have_posts()) {
// get the post
$all_event_dates->the_post();
// access post
global $post;
// init
$date = array();
// add to our array, formatted for CiviCRM
$date['occurrence_id'] = $post->occurrence_id;
$date['start'] = eo_get_the_start('Y-m-d H:i:s');
$date['end'] = eo_get_the_end('Y-m-d H:i:s');
$date['human'] = eo_get_the_start('g:ia, M jS, Y');
// add to our array
$all_dates[] = $date;
}
// reset post data
wp_reset_postdata();
}
// --<
return $all_dates;
}
开发者ID:academe,项目名称:civicrm-event-organiser,代码行数:38,代码来源:civicrm-event-organiser-eo.php
示例12: the_post_thumbnail
?>
>
<header class="entry-header">
<h1 class="entry-title">
<?php
//To Display thumbnails
if (has_post_thumbnail()) {
// check if the event has a thumbnail assigned to it.
the_post_thumbnail(array(100, 100));
}
?>
<!-- Display event title -->
<?php
the_title();
$date = eo_get_the_start('n/j/y g:i a');
echo '</h1> <br/> <h2>' . $date;
?>
</h2>
</header><!-- .entry-header -->
<ul>
<div class="entry-content">
<!-- The content or the description of the event-->
<ul class="exodus-entry-meta">
<?php
if ($liturgical = get_the_term_list($post->ID, 'liturgical_info', '', __(', ', 'exodus'))) {
?>
<ul class="exodus-entry-byline">
<?php
echo $liturgical;
开发者ID:sflebrun,项目名称:rcumc-website,代码行数:31,代码来源:single-event.php
示例13: eo_get_events
<div class="colWrapper">
<?php
$events = eo_get_events(array('numberposts' => 6, 'event_start_after' => 'today', 'showpastevents' => false));
?>
<div class="col2">
<ul>
<?php
if ($events) {
$count = 0;
foreach ($events as $event) {
$count = $count + 1;
if ($count === 4) {
?>
</ul>
</div>
<div class="col3">
<ul>
<?php
}
printf('<li><a href="%s"><span>%s</span><strong>%s</strong></a></li>', get_permalink($event->ID), eo_get_the_start('jS M', $event->ID, null, $event->occurrence_id), get_the_title($event->ID));
}
}
?>
</ul>
</div>
</div>
<a href="/calendar" class="btn">Full calendar</a>
</div>
</section>
开发者ID:mummybot,项目名称:tpbc,代码行数:31,代码来源:eventsHome.php
示例14: eo_break_occurrence
/**
* Break a specified occurrence from an event
*
* @param int $post_id The event (post) ID
* @param int $occurrence_id The occurrence ID
* @return int|WP_Error The new event (post) ID or a WP_Error on error
*/
function eo_break_occurrence($post_id, $occurrence_id)
{
global $post;
$post = get_post($post_id);
setup_postdata($post_id);
do_action('eventorganiser_pre_break_occurrence', $post_id, $occurrence_id);
$tax_input = array();
foreach (array('event-category', 'event-tag', 'event-venue') as $tax) {
$terms = get_the_terms($post->ID, $tax);
if ($terms && !is_wp_error($terms)) {
$tax_input[$tax] = array_map('intval', wp_list_pluck($terms, 'term_id'));
}
}
//Post details
$post_array = array('post_title' => $post->post_title, 'post_name' => $post->post_name, 'post_author' => $post->post_author, 'post_content' => $post->post_content, 'post_status' => $post->post_status, 'post_date' => $post->post_date, 'post_date_gmt' => $post->post_date_gmt, 'post_excerpt' => $post->post_excerpt, 'post_password' => $post->post_password, 'post_type' => 'event', 'tax_input' => $tax_input, 'comment_status' => $post->comment_status, 'ping_status' => $post->ping_status);
//Event details
$event_array = array('start' => eo_get_the_start(DATETIMEOBJ, $post_id, null, $occurrence_id), 'end' => eo_get_the_end(DATETIMEOBJ, $post_id, null, $occurrence_id), 'all_day' => eo_is_all_day($post_id) ? 1 : 0, 'schedule' => 'once', 'frequency' => 1);
//Create new event with duplicated details (new event clears cache)
$new_event_id = eo_insert_event($post_array, $event_array);
//delete occurrence, and copy post meta
if ($new_event_id && !is_wp_error($new_event_id)) {
$response = _eventorganiser_remove_occurrence($post_id, $occurrence_id);
$post_custom = get_post_custom($post_id);
foreach ($post_custom as $meta_key => $meta_values) {
//Don't copy these
$ignore_meta = array('_eventorganiser_uid', '_eo_tickets', '_edit_last', '_edit_last', '_edit_lock');
$ignore_meta = apply_filters('eventorganiser_breaking_occurrence_exclude_meta', $ignore_meta);
if (in_array($meta_key, $ignore_meta)) {
continue;
}
//Don't copy event meta
if (0 == strncmp($meta_key, '_eventorganiser', 15)) {
continue;
}
foreach ($meta_values as $meta_value) {
//get_post_meta() without a key doesn't unserialize:
// @see{https://github.com/WordPress/WordPress/blob/3.5.1/wp-includes/meta.php#L289}
$meta_value = maybe_unserialize($meta_value);
add_post_meta($new_event_id, $meta_key, $meta_value);
}
}
}
_eventorganiser_delete_calendar_cache();
do_action('eventorganiser_occurrence_broken', $post_id, $occurrence_id, $new_event_id);
wp_reset_postdata();
return $new_event_id;
}
开发者ID:windyjonas,项目名称:fredrika,代码行数:54,代码来源:event-organiser-event-functions.php
示例15: the_post
$i++;
if ($i % 2 !== 0) {
$wp_query->next_post();
} else {
the_post();
?>
<div class="news">
<article id="post-<?php
the_ID();
?>
" <?php
post_class();
?>
>
<h3 class="news-date"><?php
printf(eo_get_the_start());
?>
</h3>
<h3 class="news-title"><?php
the_title();
?>
</h3>
<?php
if (has_post_thumbnail()) {
?>
<?php
$thumb = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'medium');
?>
<div style="background:url('<?php
echo $thumb['0'];
?>
开发者ID:cmd1209,项目名称:EHM-2016,代码行数:31,代码来源:2-column-posts.php
示例16: parse_template
static function parse_template($matches)
{
global $post;
$replacement = '';
switch ($matches[1]) {
case 'event_title':
$replacement = get_the_title();
break;
case 'start':
case 'end':
case 'schedule_start':
case 'schedule_last':
case 'schedule_end':
switch (count($matches)) {
case 2:
$dateFormat = get_option('date_format');
$dateTime = get_option('time_format');
break;
case 3:
$dateFormat = self::eo_clean_input($matches[2]);
$dateTime = '';
break;
case 5:
$dateFormat = self::eo_clean_input($matches[3]);
$dateTime = self::eo_clean_input($matches[4]);
break;
}
$format = eo_is_all_day(get_the_ID()) ? $dateFormat : $dateFormat . $dateTime;
switch ($matches[1]) {
case 'start':
$replacement = eo_get_the_start($format);
break;
case 'end':
$replacement = eo_get_the_end($format);
break;
case 'schedule_start':
$replacement = eo_get_schedule_start($format);
break;
case 'schedule_last':
case 'schedule_end':
$replacement = eo_get_schedule_end($format);
break;
}
break;
case 'event_duration':
$start = eo_get_the_start(DATETIMEOBJ);
$end = clone eo_get_the_end(DATETIMEOBJ);
if (eo_is_all_day()) {
$end->modify('+1 minute');
}
if (function_exists('date_diff')) {
$duration = date_diff($start, $end);
$replacement = $duration->format($matches[2]);
} else {
$replacement = eo_date_interval($start, $end, $matches[2]);
}
$replacement = false;
break;
case 'event_tags':
$replacement = get_the_term_list(get_the_ID(), 'event-tag', '', ', ', '');
break;
case 'event_cats':
$replacement = get_the_term_list(get_the_ID(), 'event-category', '', ', ', '');
break;
case 'event_venue':
$replacement = eo_get_venue_name();
break;
case 'event_venue_map':
if (eo_get_venue()) {
$class = isset($matches[2]) ? self::eo_clean_input($matches[2]) : '';
$class = !empty($class) ? 'class=' . $class : '';
$replacement = eo_get_venue_map(eo_get_venue(), compact('class'));
}
break;
case 'event_venue_url':
$venue_link = eo_get_venue_link();
$replacement = !is_wp_error($venue_link) ? $venue_link : '';
break;
case 'event_venue_address':
$address = eo_get_venue_address();
$replacement = $address['address'];
break;
case 'event_venue_postcode':
$address = eo_get_venue_address();
$replacement = $address['postcode'];
break;
case 'event_venue_city':
$address = eo_get_venue_address();
$replacement = $address['city'];
break;
case 'event_venue_country':
$address = eo_get_venue_address();
$replacement = $address['country'];
break;
case 'event_venue_state':
$address = eo_get_venue_address();
$replacement = $address['state'];
break;
case 'event_venue_city':
$address = eo_get_venue_address();
//.........这里部分代码省略.........
开发者ID:hmorv,项目名称:Event-Organiser,代码行数:101,代码来源:class-eventorganiser-shortcodes.php
示例17: eo_break_occurrence
/**
* Break a specified occurrence from an event
*
* @param int $post_id The event (post) ID
* @param int $occurrence_id The occurrence ID
* @return int|WP_Error The new event (post) ID or a WP_Error on error
*/
function eo_break_occurrence($post_id, $occurrence_id)
{
global $post;
$post = get_post($post_id);
setup_postdata($post_id);
/**
* Triggered before an occurrence is broken from an event.
*
* @param int $post_id The ID of the original parent event
* @param int $occurrence_id The ID of the occurrence being broken
*/
do_action('eventorganiser_pre_break_occurrence', $post_id, $occurrence_id);
$tax_input = array();
foreach (array('event-category', 'event-tag', 'event-venue') as $tax) {
$terms = get_the_terms($post->ID, $tax);
if ($terms && !is_wp_error($terms)) {
$tax_input[$tax] = array_map('intval', wp_list_pluck($terms, 'term_id'));
}
}
//Post details
$post_array = array('post_title' => $post->post_title, 'post_name' => $post->post_name, 'post_author' => $post->post_author, 'post_content' => $post->post_content, 'post_status' => $post->post_status, 'post_date' => $post->post_date, 'post_date_gmt' => $post->post_date_gmt, 'post_excerpt' => $post->post_excerpt, 'post_password' => $post->post_password, 'post_type' => 'event', 'tax_input' => $tax_input, 'comment_status' => $post->comment_status, 'ping_status' => $post->ping_status);
//Event details
$event_array = array('start' => eo_get_the_start(DATETIMEOBJ, $post_id, null, $occurrence_id), 'end' => eo_get_the_end(DATETIMEOBJ, $post_id, null, $occurrence_id), 'all_day' => eo_is_all_day($post_id) ? 1 : 0, 'schedule' => 'once', 'frequency' => 1);
//Create new event with duplicated details (new event clears cache)
$new_event_id = eo_insert_event($post_array, $event_array);
//delete occurrence, and copy post meta
if ($new_event_id && !is_wp_error($new_event_id)) {
$response = _eventorganiser_remove_occurrence($post_id, $occurrence_id);
$post_custom = get_post_custom($post_id);
foreach ($post_custom as $meta_key => $meta_values) {
//Don't copy these
$ignore_meta = array('_eventorganiser_uid', '_eo_tickets', '_edit_last', '_edit_last', '_edit_lock');
/**
* Filters an array of keys which should be ignored when breaking an
* occurrence.
*
* When breaking an occurrence from an event a new event is made for
* that occurrence. Meta data from the original event is copied across,
* unless its meta key exists in the filtered array.
*
* @param array $ignore_meta Array of meta keys to be ignored
*/
$ignore_meta = apply_filters('eventorganiser_breaking_occurrence_exclude_meta', $ignore_meta);
if (in_array($meta_key, $ignore_meta)) {
continue;
}
//Don't copy event meta
if (0 == strncmp($meta_key, '_eventorganiser', 15)) {
continue;
}
foreach ($meta_values as $meta_value) {
//get_post_meta() without a key doesn't unserialize:
// @see{https://github.com/WordPress/WordPress/blob/3.5.1/wp-includes/meta.php#L289}
$meta_value = maybe_unserialize($meta_value);
add_post_meta($new_event_id, $meta_key, $meta_value);
}
}
}
_eventorganiser_delete_calendar_cache();
/**
* Triggered after an occurrence has been broken from an event.
*
* @param int $post_id The ID of the original parent event
* @param int $occurrence_id The ID of the occurrence being broken
* @param int $new_event_id The ID of the newly created event
*/
do_action('eventorganiser_occurrence_broken', $post_id, $occurrence_id, $new_event_id);
wp_reset_postdata();
return $new_event_id;
}
开发者ID:Borgoroth,项目名称:Event-Organiser,代码行数:77,代码来源:event-organiser-event-functions.php
示例18: the_permalink
<div class="mini-post-content"><h4><a href="<?php
the_permalink();
?>
" title="<?php
the_title_attribute();
?>
" ><?php
the_title();
?>
</a></h4>
<div class="mini-post-meta" style="float:left;"><img src="<?php
echo get_template_directory_uri();
?>
/images/ico1.png" width="30px" height="30px"/></div>
<?php
echo __('on', 'eventorganiser') . ' ' . eo_get_the_start($format);
?>
<br />
<div class="excerpt" style="text-align:justify;"><?php
the_excerpt();
?>
</div></div>
</li>
<?php
}
?>
</ul>
<?php
开发者ID:blogfor,项目名称:king,代码行数:31,代码来源:widget-event-list.php
示例19: exodus_post_title
<h1 class="exodus-entry-title<?php
if (is_singular(get_post_type())) {
?>
exodus-main-title<?php
}
?>
">
<?php
exodus_post_title();
echo '<br/>';
if (eo_is_all_day()) {
$format = 'n/j/y';
} else {
$format = 'n/j/y g:i a';
}
$date = eo_get_the_start($format);
echo $date;
?>
<br/>
</h1>
<?php
}
?>
<ul class="exodus-entry-meta">
<?php
if ($liturgical = get_the_term_list($post->ID, 'liturgical_info', '', __(', ', 'exodus'))) {
?>
开发者ID:sflebrun,项目名称:rcumc-website,代码行数:31,代码来源:content-event-header.php
示例20: generate_output
/**
* Generates widget / shortcode calendar html
*
* @param $month - DateTime object for first day of the month (in blog timezone)
*/
static function generate_output($month, $args = array())
{
//Translations
global $wp_locale;
$today = new DateTime('now', eo_get_blog_timezone());
$key = $month->format('YM') . serialize($args) . get_locale() . $today->format('Y-m-d');
$calendar = get_transient('eo_widget_calendar');
if ((!defined('WP_DEBUG') || !WP_DEBUG) && $calendar && is_array($calendar) && isset($calendar[$key])) {
return $calendar[$key];
}
//Parse defaults
$args['show-long'] = isset($args['show-long']) ? $args['show-long'] : false;
$args['link-to-single'] = isset($args['link-to-single']) ? $args['link-to-single'] : false;
//Month details
$first_day_of_month = intval($month->format('N'));
//0=sun,...,6=sat
$days_in_month = intval($month->format('t'));
// 28-31
$last_month = clone $month;
$last_month->modify('last month');
$next_month = clone $month;
$next_month->modify('next month');
//Retrieve the start day of the week from the options.
$start_day = intval(get_option('start_of_week'));
//0=sun,...,6=sat
//How many blank cells before inserting dates
$offset = ($first_day_of_month - $start_day + 7) % 7;
//Number of weeks to show in Calendar
$totalweeks = ceil(($offset + $days_in_month) / 7);
//Get events for this month
$start = $month->format('Y-m-d');
$end = $month->format('Y-m-t');
//Query events
$required = array('numberposts' => -1, 'showrepeats' => 1);
if ($args['show-long']) {
$args['event_start_before'] = $end;
$args['event_end_after'] = $start;
} else {
$args['event_start_before'] = $end;
$args['event_start_after'] = $start;
}
$events = eo_get_events(array_merge($args, $required));
//Populate events array
$calendar_events = array();
foreach ($events as $event) {
if ($args['show-long']) {
$start = eo_get_the_start(DATETIMEOBJ, $event->ID, null, $event->occurrence_id);
$end = eo_get_the_end(DATETIMEOBJ, $event->ID, null, $event->occurrence_id);
$pointer = clone $start;
while ($pointer <= $end) {
$date = eo_format_datetime($pointer, 'Y-m-d');
$calendar_events[$date][] = $event;
$pointer->modify('+1 day');
}
} else {
$date = eo_get_the_start('Y-m-d', $event->ID, null, $event->occurrence_id);
$calendar_events[$date][] = $event;
}
}
$before = "<table id='wp-calendar'>";
$title = sprintf("<caption> %s </caption>", esc_html(eo_format_datetime($month, 'F Y')));
$head = "<thead><tr>";
for ($d = 0; $d <= 6; $d++) {
$day = $wp_locale->get_weekday(($d + $start_day) % 7);
$day_abbrev = $wp_locale->get_weekday_initial($day);
$head .= sprintf("<th title='%s' scope='col'>%s</th>", esc_attr($day), esc_html($day_abbrev));
}
$head .= "</tr></thead>";
$foot = sprintf("<tfoot><tr>\n\t\t\t\t\t<td id='eo-widget-prev-month' colspan='3'><a title='%s' href='%s'>« %s</a></td>\n\t\t\t\t\t<td class='pad'> </td>\n\t\t\t\t\t<td id='eo-widget-next-month' colspan='3'><a title='%s' href='%s'> %s » </a></td>\n\t\t\t\t</tr></tfoot>", esc_html__('Previous month', 'eventorganiser'), add_query_arg('eo_month', $last_month->format('Y-m')), esc_html(eo_format_datetime($last_month, 'M')), esc_html__('Next month', 'eventorganiser'), add_query_arg('eo_month', $next_month->format('Y-m')), esc_html(eo_format_datetime($next_month, 'M')));
$body = "<tbody>";
$current_date = clone $month;
//Foreach week in calendar
for ($w = 0; $w <= $totalweeks - 1; $w++) {
$body .= "<tr>";
//For each cell in this week
for ($cell = $w * 7 + 1; $cell <= ($w + 1) * 7; $cell++) {
$formated_date = $current_date->format('Y-m-d');
$data = "data-eo-wc-date='{$formated_date}'";
if ($cell <= $offset) {
$body .= "<td class='pad eo-before-month' colspan='1'> </td>";
} elseif ($cell - $offset > $days_in_month) {
$body .= "<td class='pad eo-after-month' colspan='1'> </td>";
} else {
$class = array();
if ($formated_date < $today->format('Y-m-d')) {
$class[] = 'eo-past-date';
} elseif ($formated_date == $today->format('Y-m-d')) {
$class[] = 'today';
} else {
$class[] = 'eo-future-date';
}
//Does the date have any events
if (isset($calendar_events[$formated_date])) {
$class[] = 'event';
$events = $calendar_events[$formated_date];
//.........这里部分代码省略.........
开发者ID:windyjonas,项目名称:fredrika,代码行数:101,代码来源:class-eo-calendar-widget.php
注:本文中的eo_get_the_start函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论