Last active
August 29, 2015 14:05
-
-
Save robincornett/9339ee7e23f502690792 to your computer and use it in GitHub Desktop.
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*|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