Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Hay, does anyone know a way to display the featured image url within the RSS feed?

share|improve this question

1 Answer 1

up vote 3 down vote accepted
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');
share|improve this answer
    
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? –  dotty Sep 7 '10 at 14:31
    
Oh, a follow up. I'm using php's SimpleXmlElement() and reading the file through that. Will that make a difference? –  dotty Sep 7 '10 at 14:39
    
... nope reply. any ideas? –  dotty Sep 9 '10 at 13:22
    
I missed you previous comments. There was an error in my answer, I edited it. –  sorich87 Sep 9 '10 at 16:13
1  
Sorich 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 = –  jeremyclarke Sep 11 '10 at 21:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.