wordpress the_excerpt函数中文长度问题(无插件)

http://blicklamp.sinaapp.com/2011/08/21/wordpress-the_excerpt%E5%87%BD%E6%95%B0%E4%B8%AD%E6%96%87%E9%95%BF%E5%BA%A6%E9%97%AE%E9%A2%98/

 

http://wiinder.com/wordpress-new-excerpt.html

 

结合以上两篇博文 哥得出的中文摘要 无插件解决办法

functions函数中添加

function new_excerpt_length($length) {
return 75;
}
add_filter('excerpt_length', 'new_excerpt_length');
function new_excerpt_more($more) {
return '';
}
add_filter('excerpt_more', 'new_excerpt_more');
function excerpt_read_more_link($output) {

global $post;

//$output = strip_tags($output);
$output = mb_substr($output,0, 200); //此处的200大于75是没有用的 最多75 具体机制俺没细看

return $output;
}
add_filter('the_excerpt', 'excerpt_read_more_link');

 

成功解决问题

posted @ 2012-09-19 20:50  hust_zk  阅读(2176)  评论(0编辑  收藏  举报