手机
当前位置:查字典教程网 >CMS教程 >WordPress >wordpress自定义摘要截取字数的代码
wordpress自定义摘要截取字数的代码
摘要:functionexcerpt($limit){$excerpt=explode('',get_the_excerpt(),$limit);...

function excerpt($limit) {

$excerpt = explode(' ', get_the_excerpt(), $limit);

if (count($excerpt)>=$limit) {

array_pop($excerpt);

$excerpt = implode(" ",$excerpt).'...';

} else {

$excerpt = implode(" ",$excerpt);

}

$excerpt = preg_replace('`[[^]]*]`','',$excerpt);

return $excerpt;

}

【wordpress自定义摘要截取字数的代码】相关文章:

WordPress 显示文章摘要方法 详细篇

Wordpress固定链接伪静态的设置方法

Wordpress插件的使用

WordPress修改评论默认头像的方法

WordPress获取文章内容摘要的方法

WordPress给文章图片自动添加链接的方法

Wordpress自定义字段的使用心得

WordPress安装图解教程

wordpress评论者链接在新窗口中打开的方法

免插件在wordpress中插入表格的方法

精品推荐
分类导航