我正在使用我的 WordPress RSS 源在 MailChimp 中设置一个 RSS 到电子邮件活动,并且我想在我的 MailChimp 模板中包含特色图像。我尝试使用它来添加图像,它可以工作,但它只是将它添加到内容中,这对于 RSS 代码的 MailChimp 部分不起作用:
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');
显然,MailChimp 希望它是“自己的”独特的图像元素。这是他们想要的一个例子:http://kb.mailchimp.com/article/how-can-i-format-the-image-content-in-my-rss-to-email-campaigns
但它看起来像是不同的 RSS 格式。这是我的 RSS 输出的内容:http://pacmissions.org/dev/missions/zimbabwe-2012/feed/