Created
January 15, 2014 20:55
-
-
Save WebEndevSnippets/8444476 to your computer and use it in GitHub Desktop.
WordPress: Add featured image to RSS feed for use in MailChimp campaign
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
add_filter('the_excerpt_rss', 'webendev_featured_to_RSS'); | |
add_filter('the_content_feed', 'webendev_featured_to_RSS'); | |
/** | |
* Add featured image to RSS feed for use in MailChimp campaign | |
* | |
*/ | |
function webendev_featured_to_RSS($content) { | |
global $post; | |
if ( has_post_thumbnail( $post->ID ) ){ | |
$content = '<a href="' . get_permalink( $thumbnail->ID ) . '" title="' . esc_attr( $thumbnail->post_title ) . '" target="_blank">' . get_the_post_thumbnail( $post->ID, 'thumbnail', array( 'style' => 'float:left; margin: 0px 12px 10px 0;' ) ) . '</a>' . $content; | |
} | |
return $content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment