本文整理汇总了PHP中mts_excerpt函数的典型用法代码示例。如果您正苦于以下问题:PHP mts_excerpt函数的具体用法?PHP mts_excerpt怎么用?PHP mts_excerpt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mts_excerpt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: the_author_posts_link
</h2>
<div class="post-info"><span class="theauthor"><?php
the_author_posts_link();
?>
</span> | <span class="thetime"><?php
the_time(get_option('date_format'));
?>
</span></div>
</header><!--.header-->
<?php
if (empty($mts_options['mts_full_posts'])) {
?>
<div class="post-content image-caption-format-1">
<?php
echo mts_excerpt(29);
?>
</div>
<span class="readMore"><a href="<?php
the_permalink();
?>
" title="<?php
the_title();
?>
" rel="nofollow"><?php
_e('Read More', 'mythemeshop');
?>
</a></span>
<?php
} else {
?>
示例2: get_cat_posts
public function get_cat_posts($qty, $comment_num, $date, $show_thumb6, $show_excerpt, $excerpt_length)
{
global $post;
$thePostID = $post->ID;
$cats = get_the_category($thePostID);
$cat_ids = array();
foreach ($cats as $individual_cat) {
$cat_ids[] = $individual_cat->cat_ID;
}
$posts = new WP_Query(array('category__in' => $cat_ids, 'post__not_in' => array($thePostID), 'posts_per_page' => $qty, 'orderby' => 'rand'));
echo '<ul class="related-posts-widget">';
while ($posts->have_posts()) {
$posts->the_post();
?>
<li>
<a href="<?php
the_permalink();
?>
">
<?php
if ($show_thumb6 == 1) {
?>
<?php
the_post_thumbnail('widgetthumb', array('title' => ''));
?>
<?php
}
?>
<?php
the_title();
?>
</a>
<div class="meta">
<?php
if ($date == 1) {
?>
<?php
the_time('F j, Y');
?>
<?php
}
?>
<?php
if ($date == 1 && $comment_num == 1) {
?>
•
<?php
}
?>
<?php
if ($comment_num == 1) {
?>
<?php
echo comments_number(__('No Comment', 'mythemeshop'), __('One Comment', 'mythemeshop'), '<span class="comm">%</span> ' . __('Comments', 'mythemeshop'));
?>
<?php
}
?>
</div> <!--end .entry-meta-->
<?php
if ($show_excerpt == 1) {
?>
<p>
<?php
echo mts_excerpt($excerpt_length);
?>
</p>
<?php
}
?>
</li>
<?php
}
echo '</ul>' . "\r\n";
}
示例3: the_title
"><?php
the_title();
?>
</a></h2>
</header>
<div class="post-info">
<div class="thetime updated"><span itemprop="datePublished"><?php
if ($mts_options['mts_date_show'] == '1') {
the_time(get_option('date_format'));
}
?>
</span></div>
</div>
<div class="front-view-content">
<?php
echo mts_excerpt(15);
?>
</div>
</article> <!--Latest-Posts-article-3-->
<?php
$j++;
}
}
wp_reset_postdata();
?>
</div>
<?php
}
}
}
}
示例4: the_title
?>
/images/bigthumb.png" class="attachment-featured wp-post-image" alt="<?php
the_title();
?>
">
</div>
<?php
}
?>
<p class="featured-excerpt">
<span class="featured-title"><?php
the_title();
?>
</span>
<span class="f-excerpt"><?php
echo mts_excerpt(10);
?>
</span>
</p>
</a>
</div><!--.post excerpt-->
<?php
} elseif ($i == 2) {
?>
<div class="secondpost excerpt">
<a href="<?php
the_permalink();
?>
" title="<?php
the_title();
?>
示例5: the_title
the_title();
?>
"><?php
the_title();
?>
</a></h2>
<?php
mts_the_postinfo();
?>
</header>
<?php
if (empty($mts_options['mts_full_posts'])) {
?>
<div class="front-view-content">
<?php
echo mts_excerpt(55);
?>
<?php
mts_readmore();
?>
</div>
<?php
} else {
?>
<div class="front-view-content full-post">
<?php
the_content();
?>
<?php
if (mts_post_has_moretag()) {
?>
示例6: the_title
the_title();
?>
</a></h3>
<?php
if ($mts_options['mts_home_headline_meta'] == '1') {
?>
<div class="post-info">
<span class="theauthor"><i class="fa fa-user"></i> <?php
the_author_posts_link();
?>
</span>
<span class="thetime"><i class="fa fa-calendar"></i> <?php
the_time(get_option('date_format'));
?>
</span>
<span class="thecategory"><i class="fa fa-tags"></i> <?php
the_category(', ');
?>
</span>
</div>
<?php
}
?>
</header>
<div class="front-view-content">
<?php
echo mts_excerpt(48);
?>
</div>
</article><!--.post excerpt-->
示例7: get_popular_posts
public function get_popular_posts($qty, $title_length, $comment_num, $date, $days, $show_thumb3, $box_layout, $show_excerpt, $excerpt_length)
{
$no_image = $show_thumb3 ? '' : ' no-thumb';
if ('horizontal-small' === $box_layout) {
$thumbnail = 'widgetthumb';
$open_li_item = '<li class="post-box horizontal-small horizontal-container' . $no_image . '"><div class="horizontal-container-inner">';
$close_li_item = '</div></li>';
} else {
$thumbnail = 'widgetfull';
$open_li_item = '<li class="post-box vertical-small' . $no_image . '">';
$close_li_item = '</li>';
}
global $post;
$popular_days = array();
if ($days) {
$popular_days = array('after' => "{$days} day ago", 'before' => 'today', 'inclusive' => true);
}
$popular = get_posts(array('suppress_filters' => false, 'ignore_sticky_posts' => 1, 'orderby' => 'comment_count', 'numberposts' => $qty, 'date_query' => $popular_days));
echo '<ul class="popular-posts">';
foreach ($popular as $post) {
setup_postdata($post);
?>
<?php
echo $open_li_item;
?>
<?php
if ($show_thumb3 == 1) {
?>
<div class="post-img">
<a rel="nofollow" href="<?php
the_permalink();
?>
" title="<?php
the_title();
?>
">
<?php
the_post_thumbnail($thumbnail, array('title' => ''));
?>
</a>
</div>
<?php
}
?>
<div class="post-data">
<div class="post-data-container">
<div class="post-title">
<a href="<?php
the_permalink();
?>
" title="<?php
the_title();
?>
"><?php
echo mts_truncate(get_the_title(), $title_length, 'words');
?>
</a>
</div>
<?php
if ($date == 1 || $comment_num == 1 || $show_excerpt == 1) {
?>
<div class="post-info">
<?php
if ($date == 1) {
?>
<span class="thetime updated"><i class="fa fa-clock-o"></i> <?php
the_time(get_option('date_format'));
?>
</span>
<?php
}
?>
<?php
if ($comment_num == 1) {
?>
<span class="thecomment"><i class="fa fa-comments"></i> <?php
echo comments_number('0', '1', '%');
?>
</span>
<?php
}
?>
<?php
if ($show_excerpt == 1) {
?>
<div class="post-excerpt">
<?php
echo mts_excerpt($excerpt_length);
?>
</div>
<?php
}
?>
</div> <!--end .post-info-->
<?php
}
?>
</div>
</div>
<?php
//.........这里部分代码省略.........
示例8: get_popular_posts
public function get_popular_posts($qty, $comment_num, $date, $days, $show_thumb3, $show_excerpt, $excerpt_length)
{
global $post;
if ($days) {
global $popular_days;
$popular_days = $days;
// Register the filtering function
add_filter('posts_where', 'filter_where');
}
//Create a new filtering function that will add our where clause to the query
function filter_where($where = '')
{
global $popular_days;
//posts in the last X days
$where .= " AND post_date > '" . date('Y-m-d', strtotime('-' . $popular_days . ' days')) . "'";
return $where;
}
$popular = get_posts(array('suppress_filters' => false, 'ignore_sticky_posts' => 1, 'orderby' => 'comment_count', 'numberposts' => $qty));
echo '<ul class="popular-posts">';
foreach ($popular as $post) {
setup_postdata($post);
?>
<li>
<a href="<?php
the_permalink();
?>
">
<?php
if ($show_thumb3 == 1) {
?>
<?php
if (has_post_thumbnail()) {
?>
<?php
the_post_thumbnail('widgetthumb', array('title' => ''));
?>
<?php
} else {
?>
<img src="<?php
echo get_template_directory_uri();
?>
/images/smallthumb.png" alt="<?php
the_title();
?>
" class="wp-post-image" />
<?php
}
?>
<?php
}
?>
<?php
the_title();
?>
</a>
<div class="meta">
<?php
if ($date == 1) {
?>
<?php
the_time('F j, Y');
?>
<?php
}
?>
<?php
if ($date == 1 && $comment_num == 1) {
?>
•
<?php
}
?>
<?php
if ($comment_num == 1) {
?>
<?php
echo comments_number(__('No Comment', 'mythemeshop'), __('One Comment', 'mythemeshop'), '<span class="comm">%</span> ' . __('Comments', 'mythemeshop'));
?>
<?php
}
?>
</div> <!--end .entry-meta-->
<?php
if ($show_excerpt == 1) {
?>
<p>
<?php
echo mts_excerpt($excerpt_length);
?>
</p>
<?php
}
?>
</li>
<?php
}
wp_reset_postdata();
echo '</ul>' . "\r\n";
//.........这里部分代码省略.........
示例9: get_cat_posts
public function get_cat_posts($qty, $title_length, $comment_num, $date, $show_thumb2, $box_layout, $show_excerpt, $excerpt_length)
{
$no_image = $show_thumb2 ? '' : ' no-thumb';
if ('horizontal-small' === $box_layout) {
$thumbnail = 'widgetthumb';
$open_li_item = '<li class="post-box horizontal-small horizontal-container' . $no_image . '"><div class="horizontal-container-inner">';
$close_li_item = '</div></li>';
} else {
$thumbnail = 'widgetfull';
$open_li_item = '<li class="post-box vertical-small' . $no_image . '">';
$close_li_item = '</li>';
}
$posts = new WP_Query("orderby=date&order=DESC&posts_per_page=" . $qty);
echo '<ul class="advanced-recent-posts">';
while ($posts->have_posts()) {
$posts->the_post();
?>
<?php
echo $open_li_item;
?>
<?php
if ($show_thumb2 == 1) {
?>
<div class="post-img">
<a rel="nofollow" href="<?php
the_permalink();
?>
" title="<?php
the_title();
?>
">
<?php
the_post_thumbnail($thumbnail, array('title' => ''));
?>
</a>
</div>
<?php
}
?>
<div class="post-data">
<div class="post-data-container">
<div class="post-title">
<a href="<?php
the_permalink();
?>
" title="<?php
the_title();
?>
"><?php
echo mts_truncate(get_the_title(), $title_length, 'words');
?>
</a>
</div>
<?php
if ($date == 1 || $comment_num == 1) {
?>
<div class="post-info">
<?php
if ($date == 1) {
?>
<span class="thetime updated"><i class="fa fa-clock-o"></i> <?php
echo human_time_diff(get_the_time('U'), current_time('timestamp')) . __(' ago', 'mythemeshop');
?>
</span>
<?php
}
?>
<?php
if ($comment_num == 1) {
?>
<span class="thecomment"><i class="fa fa-comments"></i> <?php
echo comments_number('0', '1', '%');
?>
</span>
<?php
}
?>
</div> <!--.post-info-->
<?php
}
?>
<?php
if ($show_excerpt == 1) {
?>
<div class="post-excerpt">
<?php
echo mts_excerpt($excerpt_length);
?>
</div>
<?php
}
?>
</div>
</div>
<?php
echo $close_li_item;
?>
<?php
}
echo '</ul>' . "\r\n";
//.........这里部分代码省略.........
示例10: get_cat_posts
public function get_cat_posts($cat, $qty, $comment_num, $date, $show_thumb1, $show_excerpt, $excerpt_length)
{
$posts = new WP_Query("cat=" . $cat . "&orderby=date&order=DESC&posts_per_page=" . $qty);
echo '<ul class="category-posts">';
while ($posts->have_posts()) {
$posts->the_post();
?>
<li>
<a href="<?php
the_permalink();
?>
">
<?php
if ($show_thumb1 == 1) {
?>
<?php
the_post_thumbnail('widgetthumb', array('title' => ''));
?>
<?php
}
?>
<?php
the_title();
?>
</a>
<div class="meta">
<?php
if ($date == 1) {
?>
<?php
the_time('F j, Y');
?>
<?php
}
?>
<?php
if ($date == 1 && $comment_num == 1) {
?>
•
<?php
}
?>
<?php
if ($comment_num == 1) {
?>
<?php
echo comments_number(__('No Comment', 'mythemeshop'), __('One Comment', 'mythemeshop'), '<span class="comm">%</span> ' . __('Comments', 'mythemeshop'));
?>
<?php
}
?>
</div> <!--end .entry-meta-->
<?php
if ($show_excerpt == 1) {
?>
<p>
<?php
echo mts_excerpt($excerpt_length);
?>
</p>
<?php
}
?>
</li>
<?php
}
echo '</ul>' . "\r\n";
}
示例11: get_author_posts
public function get_author_posts($qty, $comment_num, $date, $show_thumb7, $show_excerpt, $excerpt_length)
{
global $post;
$thePostID = $post->ID;
$posts = new WP_Query(array('author' => $post->author, 'post__not_in' => array($thePostID), 'posts_per_page' => $qty, 'orderby' => 'rand'));
echo '<ul class="author-posts-widget">';
while ($posts->have_posts()) {
$posts->the_post();
?>
<li>
<a href="<?php
the_permalink();
?>
">
<?php
if ($show_thumb7 == 1) {
?>
<?php
the_post_thumbnail('widgetthumb', array('title' => ''));
?>
<?php
}
?>
<?php
the_title();
?>
</a>
<div class="meta">
<?php
if ($date == 1) {
?>
<?php
the_time('F j, Y');
?>
<?php
}
?>
<?php
if ($date == 1 && $comment_num == 1) {
?>
•
<?php
}
?>
<?php
if ($comment_num == 1) {
?>
<?php
echo comments_number(__('No Comment', 'mythemeshop'), __('1 Comment', 'mythemeshop'), '<span class="comm">%</span> ' . __('Comments', 'mythemeshop'));
?>
<?php
}
?>
</div> <!--end .entry-meta-->
<?php
if ($show_excerpt == 1) {
?>
<p>
<?php
echo mts_excerpt($excerpt_length);
?>
</p>
<?php
}
?>
</li>
<?php
}
echo '</ul>' . "\r\n";
}
示例12: mts_archive_post
function mts_archive_post($layout = '')
{
$mts_options = get_option(MTS_THEME_NAME);
?>
<header>
<h2 class="title front-view-title" itemprop="headline"><a href="<?php
the_permalink();
?>
" title="<?php
the_title();
?>
"><?php
the_title();
?>
</a></h2>
<?php
mts_the_postinfo();
?>
</header>
<a href="<?php
the_permalink();
?>
" title="<?php
the_title();
?>
" rel="nofollow" class="post-image post-image-left">
<?php
echo '<div class="featured-thumbnail">';
the_post_thumbnail('featured', array('title' => ''));
echo '</div>';
?>
<?php
if (function_exists('wp_review_show_total')) {
wp_review_show_total(true, 'latestPost-review-wrapper');
}
?>
</a>
<?php
if (empty($mts_options['mts_full_posts'])) {
?>
<div class="front-view-content">
<?php
echo mts_excerpt(29);
?>
</div>
<?php
mts_readmore();
?>
<?php
} else {
?>
<div class="front-view-content full-post">
<?php
the_content();
?>
</div>
<?php
if (mts_post_has_moretag()) {
?>
<?php
mts_readmore();
?>
<?php
}
?>
<?php
}
}
示例13: get_popular_posts
public function get_popular_posts($qty, $comment_num, $date, $days, $show_thumb3, $show_excerpt, $excerpt_length)
{
global $post;
$popular_days = array();
if ($days) {
$popular_days = array('after' => "{$days} day ago", 'before' => 'today', 'inclusive' => true);
}
$popular = get_posts(array('suppress_filters' => false, 'ignore_sticky_posts' => 1, 'orderby' => 'comment_count', 'numberposts' => $qty, 'date_query' => $popular_days));
echo '<ul class="popular-posts">';
foreach ($popular as $post) {
setup_postdata($post);
?>
<li>
<a href="<?php
the_permalink();
?>
">
<?php
if ($show_thumb3 == 1) {
?>
<?php
the_post_thumbnail('widgetthumb', array('title' => ''));
?>
<?php
}
?>
<?php
the_title();
?>
</a>
<div class="meta">
<?php
if ($date == 1) {
?>
<?php
the_time('F j, Y');
?>
<?php
}
?>
<?php
if ($date == 1 && $comment_num == 1) {
?>
•
<?php
}
?>
<?php
if ($comment_num == 1) {
?>
<?php
echo comments_number(__('No Comment', 'mythemeshop'), __('One Comment', 'mythemeshop'), '<span class="comm">%</span> ' . __('Comments', 'mythemeshop'));
?>
<?php
}
?>
</div> <!--end .entry-meta-->
<?php
if ($show_excerpt == 1) {
?>
<p>
<?php
echo mts_excerpt($excerpt_length);
?>
</p>
<?php
}
?>
</li>
<?php
}
wp_reset_postdata();
echo '</ul>' . "\r\n";
}
示例14: get_author_posts
public function get_author_posts($qty, $title_length, $comment_num, $date, $show_thumb7, $box_layout, $show_excerpt, $excerpt_length)
{
$no_image = $show_thumb7 ? '' : ' no-thumb';
if ('horizontal-small' === $box_layout) {
$thumbnail = 'widgetthumb';
$open_li_item = '<li class="post-box horizontal-small horizontal-container' . $no_image . '"><div class="horizontal-container-inner">';
$close_li_item = '</div></li>';
} else {
$thumbnail = 'widgetfull';
$open_li_item = '<li class="post-box vertical-small' . $no_image . '">';
$close_li_item = '</li>';
}
global $post;
$thePostID = $post->ID;
$posts = new WP_Query(array('author' => $post->post_author, 'post__not_in' => array($thePostID), 'posts_per_page' => $qty, 'orderby' => 'rand'));
echo '<ul class="author-posts-widget">';
while ($posts->have_posts()) {
$posts->the_post();
?>
<?php
echo $open_li_item;
?>
<?php
if ($show_thumb7 == 1) {
?>
<div class="post-img">
<a rel="nofollow" href="<?php
the_permalink();
?>
" title="<?php
the_title();
?>
">
<?php
the_post_thumbnail($thumbnail, array('title' => ''));
?>
</a>
</div>
<?php
}
?>
<div class="post-data">
<div class="post-data-container">
<div class="post-title">
<a href="<?php
the_permalink();
?>
" title="<?php
the_title();
?>
"><?php
echo mts_truncate(get_the_title(), $title_length, 'words');
?>
</a>
</div>
<?php
if ($date == 1 || $comment_num == 1 || $show_excerpt == 1) {
?>
<div class="post-info">
<?php
if ($date == 1) {
?>
<span class="thetime updated"><i class="fa fa-clock-o"></i> <?php
the_time(get_option('date_format'));
?>
</span>
<?php
}
?>
<?php
if ($comment_num == 1) {
?>
<span class="thecomment"><i class="fa fa-comments"></i> <?php
echo comments_number('0', '1', '%');
?>
</span>
<?php
}
?>
<?php
if ($show_excerpt == 1) {
?>
<div class="post-excerpt">
<?php
echo mts_excerpt($excerpt_length);
?>
</div>
<?php
}
?>
</div><!--.post-info-->
<?php
}
?>
</div>
</div>
<?php
echo $close_li_item;
?>
<?php
//.........这里部分代码省略.........
示例15: get_cat_posts
public function get_cat_posts($qty, $title_length, $comment_num, $date, $show_thumb6, $box_layout, $show_excerpt, $excerpt_length)
{
$no_image = $show_thumb6 ? '' : ' no-thumb';
if ('horizontal-small' === $box_layout) {
$thumbnail = 'widgetthumb';
$open_li_item = '<li class="post-box horizontal-small horizontal-container' . $no_image . '"><div class="horizontal-container-inner">';
$close_li_item = '</div></li>';
} else {
$thumbnail = 'widgetfull';
$open_li_item = '<li class="post-box vertical-small' . $no_image . '">';
$close_li_item = '</li>';
}
global $post;
$thePostID = $post->ID;
$cats = get_the_category($thePostID);
$cat_ids = array();
foreach ($cats as $individual_cat) {
$cat_ids[] = $individual_cat->cat_ID;
}
$posts = new WP_Query(array('category__in' => $cat_ids, 'post__not_in' => array($thePostID), 'posts_per_page' => $qty, 'orderby' => 'rand'));
echo '<ul class="related-posts-widget">';
while ($posts->have_posts()) {
$posts->the_post();
?>
<?php
echo $open_li_item;
?>
<?php
if ($show_thumb6 == 1) {
?>
<div class="post-img">
<a rel="nofollow" href="<?php
the_permalink();
?>
" title="<?php
the_title();
?>
">
<?php
the_post_thumbnail($thumbnail, array('title' => ''));
?>
</a>
</div>
<?php
}
?>
<div class="post-data">
<div class="post-data-container">
<div class="post-title">
<a href="<?php
the_permalink();
?>
" title="<?php
the_title();
?>
"><?php
echo mts_truncate(get_the_title(), $title_length, 'words');
?>
</a>
</div>
<?php
if ($date == 1 || $comment_num == 1) {
?>
<div class="post-info">
<?php
if ($date == 1) {
?>
<span class="thetime updated"><i class="fa fa-clock-o"></i> <?php
echo human_time_diff(get_the_time('U'), current_time('timestamp')) . __(' ago', 'mythemeshop');
?>
</span>
<?php
}
?>
<?php
if ($comment_num == 1) {
?>
<span class="thecomment"><i class="fa fa-comments"></i> <?php
echo comments_number('0', '1', '%');
?>
</span>
<?php
}
?>
</div> <!--end .post-info-->
<?php
}
?>
<?php
if ($show_excerpt == 1) {
?>
<div class="post-excerpt">
<?php
echo mts_excerpt($excerpt_length);
?>
</div>
<?php
}
?>
</div>
//.........这里部分代码省略.........