/ Published in: PHP

To encourage subscribers to visit your website, rather than letting them just consume content through your RSS feed, you might want to display only the excerpt and featured image of posts.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/** ******** ******** ******** ******** ******** ******** ******** ******** * Title: Show Featured Images In Feed * Description: Same as above * http://www.smashingmagazine.com/2011/12/07/10-tips-optimize-wordpress-theme/ * * */ function rss_post_thumbnail($content) { global $post; if( has_post_thumbnail($post->ID) ) $content = '<p>' . get_the_post_thumbnail($post->ID, 'thumbnail') . '</p>' . $content; return $content; } add_filter('the_content_feed', 'rss_post_thumbnail');
URL: http://www.smashingmagazine.com/2011/12/07/10-tips-optimize-wordpress-theme/
Comments
