text Theme_the_excerpt more excrpt阅读更多内容阅读更多摘录长度摘录大小
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text Theme_the_excerpt more excrpt阅读更多内容阅读更多摘录长度摘录大小相关的知识,希望对你有一定的参考价值。
function new_excerpt_more( $more ) {
return '[.....]';
}
add_filter('excerpt_more', 'new_excerpt_more');
<?php theme_the_excerpt( get_the_ID(), 15 ); ?>
function theme_the_excerpt( $id, $words, $end = '' ) {
$current_post = get_post( $id );
if ( trim( $current_post->post_excerpt ) ) {
echo '<p>'.wp_trim_words( $current_post->post_excerpt, $words, $end ).'</p>';
} elseif ( strpos( $current_post->post_content, '<!--more-->' ) !== false ) {
echo '<p>'.wp_trim_words( $current_post->post_content, $words, $end ).'</p>';
} else {
echo '<p>'.wp_trim_words( $current_post->post_excerpt, $words, $end ).'</p>';
}
}
function theme_the_excerpt() {
global $post;
global $more;
$more = 0;
if (trim($post->post_excerpt)) {
the_excerpt();
} elseif (strpos($post->post_content, '<!--more-->') !== false) {
the_content();
} else {
the_excerpt();
}
}
function the_excerpt_max_charlength($charlength) {
$excerpt = get_the_excerpt();
$charlength++;
if ( mb_strlen( $excerpt ) > $charlength ) {
$subex = mb_substr( $excerpt, 0, $charlength - 5 );
$exwords = explode( ' ', $subex );
$excut = - ( mb_strlen( $exwords[ count( $exwords ) - 1 ] ) );
if ( $excut < 0 ) {
echo trim(mb_substr( $subex, 0, $excut ));
} else {
echo trim($subex);
}
echo '...';
} else {
echo $excerpt;
}
}
<?php echo the_excerpt_max_charlength(100); ?>
----- limit excerpt обрезать эксерпт
http://smallenvelop.com/4-ways-to-limit-post-excerpt-length-in-wordpress/
以上是关于text Theme_the_excerpt more excrpt阅读更多内容阅读更多摘录长度摘录大小的主要内容,如果未能解决你的问题,请参考以下文章
text mo_interface.log
text mo_interface.log
递归问题;解析 JSON
.Mo翻译文件结构解析
022cr18nl14mo3是啥材料
Android M MO流程并与Android L MO对比