本文整理汇总了PHP中TribeEvents::truncate方法的典型用法代码示例。如果您正苦于以下问题:PHP TribeEvents::truncate方法的具体用法?PHP TribeEvents::truncate怎么用?PHP TribeEvents::truncate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TribeEvents
的用法示例。
在下文中一共展示了TribeEvents::truncate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_the_post_thumbnail
}
?>
</abbr><!-- .dtend -->
</div><!-- .duration -->
<div class="tribe-events-event-body">
<?php
if (has_post_thumbnail($event->ID)) {
?>
<div class="tribe-events-event-thumb "><?php
echo get_the_post_thumbnail($event->ID, array(75, 75));
?>
</div>
<?php
}
?>
<p class="entry-summary description">
<?php
if (has_excerpt($event->ID)) {
echo TribeEvents::truncate($event->post_excerpt, 30);
} else {
echo TribeEvents::truncate($event->post_content, 30);
}
?>
</p><!-- .entry-summary -->
</div><!-- .tribe-events-event-body -->
<span class="tribe-events-arrow"></span>
</div><!-- .tribe-events-tooltip -->
示例2: 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 />";
}
}
}