jacall.net
前端开发工作者
© JaCall.Net
All Rights Reserved.
皖ICP备13004974号-1

摘要

<?php echo the_excerpt(); ?>

//控制摘要字数
function new_excerpt_length($length) {
    return 300;
}
add_filter("excerpt_length", "new_excerpt_length");

//更改摘要末尾的默认显示样式
function new_excerpt_more($excerpt) {
    return str_replace("[...]", "...", $excerpt);
}
add_filter("wp_trim_excerpt", "new_excerpt_more");

//添加自定义结尾
function new_excerpt_more($more) {
global $post;
return " <a href=". get_permalink($post->ID) . ">阅读更多</a>";
}
add_filter("excerpt_more", "new_excerpt_more");

<?php echo mb_substr(get_the_excerpt(),0,22,"utf8");?>
<?php echo mb_strimwidth(strip_tags(apply_filters('the_content', $post->post_content)), 0, 300,"..."); ?>

 

2013-07-17
6,171 views
关键字:
暂无评论

发表回复