我正在使用Wordpress RSS在我的iOS项目中使用。 Feed中没有缩略图链接,因此我搜索并找到了此代码以将缩略图链接添加到Feed中。使用其他标记添加缩略图到WordPress RSS
/* include thumbnail in RSS feed */
function add_thumb_to_RSS($content) {
global $post;
if (has_post_thumbnail($post->ID)){
$content = '' . get_the_post_thumbnail($post->ID, 'thumbnail') . '' . $content;
}
return $content;
}
add_filter('the_excerpt_rss', 'add_thumb_to_RSS');
add_filter('the_content_feed', 'add_thumb_to_RSS')
该代码添加在饲料中的图片链接,但它在描述标签的开头这样增加了为html代码:
<description>
<![CDATA[
<img width="150" height="150" src="http://www.ipadia.co/wp-content/uploads/2012/02/sayfada-bul-150x150.png" class="attachment-thumbnail wp-post-image" alt="sayfada bul" title="sayfada bul" />Some text some text Some text some text Some text some text Some text some text Some text some text Some text some text ....
]]>
</description>
我要添加图片链接与其他标记像<image>
或<thumb> the link </thumb>
。所以我可以更轻松地解析它。
我该怎么做?提前致谢。
比我的示例更好:) –