Hay, does anyone know a way to display the featured image url within the RSS feed?
1 Answer
function add_featured_image_url($output) {
global $post;
if ( has_post_thumbnail( $post->ID ) ){
$output = wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) ) . ' ' . $output;
}
return $output;
}
add_filter('the_excerpt_rss', 'add_featured_image_url');
add_filter('the_content_feed', 'add_featured_image_url');
-
I've added this to my templates functions.php file, but when i read the feed i cannot see it. Do i need to do anything else to it?– dottySep 7, 2010 at 14:31
-
Oh, a follow up. I'm using php's SimpleXmlElement() and reading the file through that. Will that make a difference?– dottySep 7, 2010 at 14:39
-
-
I missed you previous comments. There was an error in my answer, I edited it.– sorich87Sep 9, 2010 at 16:13
-
1Sorich I think there's still an error, the code above will remove the post content and replace it with the url instead of adding it. Needs to be $output .= wp_get_att[...] instead of = Sep 11, 2010 at 21:12