Skip to content

Instantly share code, notes, and snippets.

@robincornett robincornett/functions.php
Last active Aug 29, 2015

Embed
What would you like to do?
add featured image to feed (for feeds using excerpts instead of full content). Uses the thumbnail sized image, aligned left, with a margin for the email.
<?php
// you can add this to your theme's functions.php file. do not include the opening tag.
add_filter( 'the_excerpt_rss', 'rgc_add_featured_image_to_feed_excerpt', 1000, 1 );
function rgc_add_featured_image_to_feed_excerpt( $content ) {
if ( has_post_thumbnail( get_the_ID() ) ) {
$content = get_the_post_thumbnail( get_the_ID(), 'thumbnail', array( 'align' => 'left', 'style' => 'margin-right:20px;' ) ) . $content;
}
return $content;
}
*|RSSITEMS:|*
<h2 class="mc-toc-title"><a href="*|RSSITEM:URL|*" target="_blank">*|RSSITEM:TITLE|*</a></h2>
<em>By *|RSSITEM:AUTHOR|*</em><br />
*|RSSITEM:CONTENT|*<br />
*|END:RSSITEMS|*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.