Quantcast
Channel: Topic Tag: plugin | WordPress.org
Viewing all articles
Browse latest Browse all 26892

ashdav on "Adding Images to RSS for use in Mailchimp RSS campaigns"

$
0
0

Ok I've found a solution.

In your themes functions.php file, add this code

function featuredtoRSS($content) {
global $post;
if ( has_post_thumbnail( $post->ID ) ){
$content = '' . get_the_post_thumbnail( $post->ID, 'full', array( 'style' => 'float:left; margin:10px 15px px 0;' ) ) . '' . $content;
}
return $content;
}

add_filter('the_excerpt_rss', 'featuredtoRSS');
add_filter('the_content_feed', 'featuredtoRSS');

?>

This will then call up the featured image of your post and embed it in your RSS feed. You can change the margins and styles within that code too.

Crucially, I found it took a few hours to wade through to my feed. I'm using Feedburner on Mailchimp and, because it didn't work instantly, I figured it didn't work. Give it time.

This code won't allow the use of *|RSSITEM:IMAGE|* but if you embed the post in Mailchimp via *|RSSITEM:CONTENT|* then it will add a full-sized featured image followed by your post's excerpt.

Hopefully this solution works for other people! Remember to give it some time to update :)

Ash


Viewing all articles
Browse latest Browse all 26892

Trending Articles