本文整理汇总了PHP中eo_get_the_start函数的典型用法代码示例。如果您正苦于以下问题:PHP eo_get_the_start函数的具体用法?PHP eo_get_the_start怎么用?PHP eo_get_the_start使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eo_get_the_start函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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>';
}
}
示例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>';
}
示例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;
?>
示例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);
示例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
}
}
示例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);
}
}
}
}
示例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>
示例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;
}
示例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;
}
示例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;
示例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>
示例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;
}
示例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'];
?>