本文整理汇总了PHP中evolve_truncate函数的典型用法代码示例。如果您正苦于以下问题:PHP evolve_truncate函数的具体用法?PHP evolve_truncate怎么用?PHP evolve_truncate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了evolve_truncate函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: evolve_posts_slider
function evolve_posts_slider()
{
?>
<div id="slide_holder">
<div class="slide-container">
<ul id="slides">
<?php
$number_items = evolve_get_option('evl_posts_number', '5');
$slider_content = evolve_get_option('evl_posts_slider_content', 'recent');
$slider_content_category = '';
$slider_content_category = evolve_get_option('evl_posts_slider_id', '');
//make array categories into string with commas.
if (is_array($slider_content_category)) {
$slider_content_category = implode(",", $slider_content_category);
}
if ($slider_content == "category" && !empty($slider_content_category)) {
$slider_content_ID = $slider_content_category;
} else {
$slider_content_ID = '';
}
$args = array('cat' => $slider_content_ID, 'showposts' => $number_items, 'ignore_sticky_posts' => 1);
query_posts($args);
if (have_posts()) {
$featured = new WP_Query($args);
while ($featured->have_posts()) {
$featured->the_post();
?>
<li class="slide">
<?php
if (has_post_thumbnail()) {
echo '<div class="featured-thumbnail"><a href="';
the_permalink();
echo '">';
the_post_thumbnail('slider-thumbnail');
echo '</a></div>';
} else {
$image = evolve_get_first_image();
if ($image) {
echo '<div class="featured-thumbnail"><a href="';
the_permalink();
echo '"><img src="' . $image . '" alt="';
the_title();
echo '" /></a></div>';
}
}
?>
<h2 class="featured-title">
<a class="title" href="<?php
the_permalink();
?>
">
<?php
$title = the_title('', '', false);
$length = evolve_get_option('evl_posts_slider_title_length', 40);
echo evolve_truncate($title, $length, '...');
?>
</a>
</h2>
<p><?php
$excerpt_length = evolve_get_option('evl_posts_slider_excerpt_length', 40);
echo evolve_excerpt_max_charlength($excerpt_length);
?>
</p>
<a class="button post-more" href="<?php
the_permalink();
?>
"><?php
_e('Read more', 'evolve');
?>
</a>
</li>
<?php
}
?>
<?php
} else {
?>
<li><?php
_e('<h2 style="color:#fff;">Oops, no posts to display! Please check your post slider Category (ID) settings</h2>', 'evolve');
?>
</li>
<?php
}
?>
<?php
wp_reset_query();
?>
</ul>
</div>
</div>
//.........这里部分代码省略.........
示例2: the_permalink
<?php
} else {
?>
<h1 class="entry-title">
<a href="<?php
the_permalink();
?>
" rel="bookmark" title="Permanent Link to <?php
the_title();
?>
">
<?php
if (get_the_title()) {
$title = the_title('', '', false);
echo evolve_truncate($title, $evolve_posts_excerpt_title_length, '...');
}
?>
</a>
</h1>
<?php
if ($evolve_edit_post == "1") {
?>
<?php
if (current_user_can('edit_post', $post->ID)) {
?>
<?php
edit_post_link(__('EDIT', 'evolve'), '<span class="edit-post edit-attach">', '</span>');
?>
<?php
}
示例3: the_permalink
<?php
} else {
?>
<h1 class="entry-title"><a href="<?php
the_permalink();
?>
" rel="bookmark" title="Permanent Link to <?php
the_title();
?>
">
<?php
if (get_the_title()) {
$title = the_title('', '', false);
echo evolve_truncate($title, 40, '...');
}
?>
</a> </h1>
<?php
if (current_user_can('edit_post', $post->ID)) {
?>
<?php
edit_post_link(__('EDIT', 'evolve'), '<span class="edit-post edit-attach">', '</span>');
?>
<?php
}
?>
<?php
示例4: widget
//.........这里部分代码省略.........
if (has_post_thumbnail()) {
?>
<div class="image">
<a href="<?php
the_permalink();
?>
">
<?php
the_post_thumbnail('tabs-img');
?>
</a>
</div>
<?php
}
?>
<div class="post-holder">
<a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a>
<div class="meta">
<?php
the_time(get_option('date_format'));
?>
</div>
</div>
</li>
<?php
}
?>
</ul>
<?php
}
?>
</div>
<?php
}
?>
<?php
if ($show_comments == 'true') {
?>
<div id="tab-comments" class="tab tab_content" style="display: none;">
<ul class="news-list">
<?php
$number = $instance['comments'];
global $wpdb;
$recent_comments = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_author_email, comment_date_gmt, comment_approved, comment_type, comment_author_url, SUBSTRING(comment_content,1,110) AS com_excerpt FROM {$wpdb->comments} LEFT OUTER JOIN {$wpdb->posts} ON ({$wpdb->comments}.comment_post_ID = {$wpdb->posts}.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC LIMIT {$number}";
$the_comments = $wpdb->get_results($recent_comments);
foreach ($the_comments as $comment) {
?>
<li>
<div class="image">
<?php
echo get_avatar($comment, '50');
?>
</div>
<div class="post-holder">
<a class="comment-text-side" href="<?php
echo get_permalink($comment->ID);
?>
#comment-<?php
echo $comment->comment_ID;
?>
" title="<?php
echo strip_tags($comment->comment_author);
?>
on <?php
echo $comment->post_title;
?>
"><?php
echo strip_tags($comment->comment_author);
_e('says', 'evolve');
?>
</a>
<div class="meta">
<?php
echo evolve_truncate(strip_tags($comment->com_excerpt), 70);
?>
</div>
</div>
</li>
<?php
}
?>
</ul>
</div>
<?php
}
?>
</div>
</div>
</div>
<?php
echo $after_widget;
}
示例5: get_the_content
</a></span>';
}
}
?>
<?php
}
?>
<?php
$postexcerpt = get_the_content();
$postexcerpt = apply_filters('the_content', $postexcerpt);
$postexcerpt = str_replace(']]>', ']]>', $postexcerpt);
$postexcerpt = strip_tags($postexcerpt);
$postexcerpt = strip_shortcodes($postexcerpt);
echo evolve_truncate($postexcerpt, 350, ' [...]');
?>
<div class="entry-meta entry-footer">
<div class="read-more btn btn-right icon-arrow-right">
<a href="<?php
the_permalink();
?>
"><?php
_e('READ MORE', 'evolve');
?>
</a>
</div>
示例6: evolve_posts_slider
function evolve_posts_slider()
{
?>
<div id="slide_holder">
<div class="slide-container">
<ul id="slides">
<?php
$number_items = evolve_get_option('evl_posts_number', '5');
$slider_content = evolve_get_option('evl_posts_slider_content', 'recent');
$slider_content_category = '';
$slider_content_category = evolve_get_option('evl_posts_slider_id', '');
if ($slider_content == "category" && !empty($slider_content_category)) {
$slider_content_ID = $slider_content_category;
} else {
$slider_content_ID = '';
}
$args = array('cat' => $slider_content_ID, 'showposts' => $number_items, 'ignore_sticky_posts' => 1);
query_posts($args);
?>
<?php
if (have_posts()) {
$featured = new WP_Query($args);
while ($featured->have_posts()) {
$featured->the_post();
?>
<li class="slide">
<?php
if (has_post_thumbnail()) {
echo '<div class="featured-thumbnail"><a href="';
the_permalink();
echo '">';
the_post_thumbnail('slider-thumbnail');
echo '</a></div>';
} else {
$image = evolve_get_first_image();
if ($image) {
echo '<div class="featured-thumbnail"><a href="';
the_permalink();
echo '"><img src="' . $image . '" alt="';
the_title();
echo '" /></a></div>';
}
}
?>
<h2 class="featured-title">
<a class="title" href="<?php
the_permalink();
?>
">
<?php
$title = the_title('', '', false);
echo evolve_truncate($title, 40, '...');
?>
</a>
</h2>
<p>
<?php
$postexcerpt = get_the_content();
$postexcerpt = apply_filters('the_content', $postexcerpt);
$postexcerpt = str_replace(']]>', ']]>', $postexcerpt);
$postexcerpt = strip_tags($postexcerpt);
$postexcerpt = strip_shortcodes($postexcerpt);
echo evolve_truncate($postexcerpt, 180, ' [...]');
?>
</p>
<a class="post-more" href="<?php
the_permalink();
?>
"><?php
_e('Read more', 'evolve');
?>
</a>
</li>
<?php
}
?>
<?php
} else {
?>
<li>
//.........这里部分代码省略.........