Created
June 7, 2018 15:39
-
-
Save jplouback/c68f000728c12ced82944d74f0a71f1b to your computer and use it in GitHub Desktop.
Inserindo imagem destacada no feed do site - Wordpress
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
/* Adicionando post_thumbnail no feed */ | |
add_action( 'rss2_item', 'custom_thumbnail_tag' ); | |
function custom_thumbnail_tag() { | |
global $post; | |
if ( has_post_thumbnail( $post->ID ) ) { | |
$thumbnail = get_the_post_thumbnail_url( $post->ID ); | |
echo("<image>{$thumbnail}</image>"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment