Created
March 27, 2017 17:17
-
-
Save arianimartins/7c243c8807db6dfce86abde24cd506e4 to your computer and use it in GitHub Desktop.
Adicionar imagem de destaque do WP no RSS/Feed
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
//Adiciona Imagem de Destaque no feed RSS | |
function featuredtoRSS($content) { | |
global $post; | |
if (has_post_thumbnail($post->ID)){ | |
$content = '<div>'.get_the_post_thumbnail($post->ID, 'medium', array('style'=>'margin-bottom:15px;')).'</div>'.$content; | |
} | |
return $content; | |
} | |
add_filter('the_excerpt_rss', 'featuredtoRSS'); | |
add_filter('the_content_feed', 'featuredtoRSS'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment