pasckr 发表于 2016-5-12 18:17:49

WordPress文章摘要支持HTML标签






                在进行 WordPress 主题开发的时候,使用 the_excerpt() 调用出来的文章摘要是不支持 HTML 标签的,但我们还是可以通过 filter 的方法来让文章摘要支持 HTML 标签,可以在主题的 functions.php 里加入以下代码。
add_filter('the_excerpt', 'excerpt_force_balance_tags'); function excerpt_force_balance_tags ($output) {   return $output = force_balance_tags($output);; }   如果真的需要让文章摘要支持 HTML 标签,建议加上条件判断,不要在 RSS 中将文章摘要里的 HTML 代码展示出来。
页: [1]
查看完整版本: WordPress文章摘要支持HTML标签