/* =============================================================================
Start Remove Junk from RSS Feed
========================================================================== */
// credit url of original post etc, etc...
function skill_rss_images( $content ) {
global $post;
// featured image with watermark
if ( has_post_thumbnail( $post->ID ) ) {
$content = '<div><a href="' . get_permalink( $post->ID ) . '" target="_blank">' . get_the_post_thumbnail( $post->ID, 'large' ) . '</a></div>';
}
// images in the post body, no watermark
else {
$content = get_the_content();
preg_match_all( '/<img[^>]+>/i', $content, $result );
$imgs = $result[0];
$content = "";
foreach( $imgs as $img ){
$content .= $img . "<br />";
}
}
return $content;
}
add_filter( 'the_content', 'skill_rss_images' );
add_filter( 'the_excerpt_rss', 'skill_rss_images' );
add_filter( 'the_content_feed', 'skill_rss_images' );
/* =============================================================================
End Remove Junk from RSS Feed
========================================================================== */