1
我想在functions.php中使用此函数来获取帖子的缩略图并将它们添加到我的RSS提要。WordPress的add_filter()将第一张图片添加到RSS - 导致服务器错误
function featuredtoRSS($content)
{
global $post;
if (has_post_thumbnail($post->ID)) {
$content = '' . get_the_post_thumbnail($post->ID, 'thumbnail', array('style' => 'float:left; margin:0 15px 15px 0;')) . '' . $content;
}
return $content;
}
add_filter('the_excerpt_rss', 'featuredtoRSS');
add_filter('the_content_feed', 'featuredtoRSS');
问题是 - 这使我的服务器崩溃。我得到一个500错误。如果我将add-filter
行注释掉,则不会出现错误。
任何人都会举手这是怎么回事?我正在使用Wordpress 3.1.2,论文主题。
谢谢!
这很有趣,感谢您的评论 - 我会考虑这一点,并更新找回 – pepe 2011-05-04 02:04:10