WordPress rss

WordPress 首页摘要而RSS全文输出解决方案(转载)

Posted by admin on November 16, 2007 in 电脑网络, 网络教程

但是WordPress有个问题,一旦使用More,在RSS中 将会输出文章摘要而不是全文内容了。我曾经也承诺过,除了我操作失误,否则Blog内不会出现摘要输出 以及 付费评论这2大博客的毒瘤。为了这个,询问了朋友和查阅Google,最后找到解决办法 一劳永逸的方法,具体办法如下:

1. 首先在文章中 使用More的代码,插入到你需要的位置;
2. 然后,修改WordPress 里面wp-includes文件夹中的post-template.php文件,使用任何代码编辑器打开,在里面找到以下If 代码:
if( preg_match(’/<!–more(.*?)?–>/’, $content, $matches) ){
$content = explode($matches[0], $content, 2);
if ( !empty($matches[1]) && !empty($more_link_text) )
$more_link_text = strip_tags(wp_kses_no_null(trim($matches[1])));
}
我们需要修改的就第一句话:
if ( preg_match(’/<!–more(.*?)?–>/’, $content, $matches ) ){
修改为(粗体字部分):
if ( preg_match(’/<!–more(.*?)?–>/’, $content, $matches) && !is_feed() ){
如此一来,WordPress的More功能就不会影响到我们RSS的输出了。