Created
September 14, 2013 21:31
-
-
Save theukedge/6565836 to your computer and use it in GitHub Desktop.
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
<?php | |
function featured_image_in_feed( $content ) { | |
global $post; | |
if( is_feed() ) { | |
if( has_post_thumbnail( $post->ID ) ){ | |
$output = get_the_post_thumbnail( $post->ID, 'large', array( 'style' => 'float:right; margin: 10px;' ) ); | |
$content = $output . $content; | |
} | |
if( has_post_format( 'gallery' ) ) { | |
$output = '<p>This post contains a gallery. <a href="' . get_permalink( $post->ID ) . '">View the gallery</a> on the website.</p>'; | |
$content = $output . $content; | |
} | |
if( has_post_format( 'video' ) ) { | |
$output = '<p>This post contains a video. <a href="' . get_permalink( $post->ID ) . '">View the video</a> on the website.</p>'; | |
$content = $output . $content; | |
} | |
if( has_post_format( 'audio' ) ) { | |
$output = '<p>This post contains some audio. <a href="' . get_permalink( $post->ID ) . '">Listen to the audio</a> on the website.</p>'; | |
$content = $output . $content; | |
} | |
} | |
return $content; | |
} | |
add_filter( 'the_content', 'featured_image_in_feed' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment