改造了WP的Feed

WP默认的Feed订阅时输出的只有文本,经过修改可以输出链接和图片等格式信息了
不错,我的第一篇技术博哟,走过路过千万不要错过~~~

步骤如下:
编辑wp-includes下的feed-functions.php,加入以下函数:

  1. /* 输出全部内容供订阅 */
  2. function the_content_rss2($more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {
  3.     $content = get_the_content($more_link_text, $stripteaser, $more_file);
  4.     $content = apply_filters('the_content_rss', $content);
  5.     $content = htmlspecialchars($content);
  6.     echo $content;
  7. }

编辑wp-rss2.php,查找:

  1. <?php else : ?>
  2.         <description><![CDATA[<?php the_excerpt_rss() ?>]]></description>

修改为:

  1. <?php else : ?>
  2.         <description><?php the_content_rss2('', 0, '') ?></description>

好吧,等lilina下次更新缓存看看效果对不对

对了还有一个问题就是rss里就看不出来coolcode的效果了
还好不是经常写代码

麻痹的换行又被过滤没了

标签:,

相关日志 随机文章

Comments

Leave a Reply




请输入验证码

Use "<coolcode></coolcode>" to publish your code.

Line breaks and paragraphs are automatically converted.

Please keep comments relevant. Off-topic, offensive or inappropriate comments may be edited or removed.

京ICP备05059555号