Hey guys, can anyone help me out with this?
I have one attachment image/post and I need to show it as a link to the actual post in the WordPress RSS feed.
I followed a tut and am currently doing this:
<?php function mf_feedimgs($content) {
global $post, $wpdb;
$attachment_id = $wpdb?>get_var("SELECT ID FROM $wpdb->posts WHERE post_parent = '$post->ID'
AND post_status = 'inherit' AND post_type='attachment' ORDER BY post_date DESC LIMIT 1");
$content = '<a href=". the_permalink($post->ID) ."><img src=". wp_get_attachment_url($attachment_id) ." /></a>' . $content;
return $content;
}
add_filter('the_content_feed', 'mf_feedimgs');
?>
This does output the image in the feed, but instead of linking it to the actual post, it links it to the site homepage and it also echoes the post URL above it, like in the image:

I’ve asked on the tutorial site but didn’t get a solution… any ideas?
Thanks!
Sorry for the shameless bump, but I’m surprised no one answered this…
And since the forum messes up the code, here it is, exactly as used: http://tinypaste.com/8725c.
Appreciate any ideas you guys might have, thanks 
- Author had a File in an Envato Bundle
- Author was Featured
- Bought between 1 and 9 items
- Europe
- Exclusive Author
- Has been a member for 2-3 years
- Item was Featured
- Referred between 100 and 199 users
wp_get_attachment_url($attachment_id)
you will need to interpret the query with the wordpress function
<?php setup_postdata($post); ?>
this will work 
It’s not about the image not showing up.
I use that function both in the feed and on the site and it’s working fine in the later case.
I’m worried about the anchor; if I remove it, it’s all good, image shows up with no link. If I add it, it spits it like in the image above…
- Author had a File in an Envato Bundle
- Author was Featured
- Bought between 1 and 9 items
- Europe
- Exclusive Author
- Has been a member for 2-3 years
- Item was Featured
- Referred between 100 and 199 users
try permalink without echo get_permalink()
How could I forget that? 
Thanks, I’ve added it now, but I’ll have to wait for Feedburner to update, so no feedback too soon. 
Thanks again 
- Author had a File in an Envato Bundle
- Author was Featured
- Bought between 1 and 9 items
- Europe
- Exclusive Author
- Has been a member for 2-3 years
- Item was Featured
- Referred between 100 and 199 users
you are welcome 
Sorry for the late update…
So I can confirm it’s working now, here’s the final code. 
What about this?
function wptuts_feedimgs( $content ) {
global $post;
if ( has_post_thumbnail( $post->ID ) )
$content = '<p><a href=" . get_permalink( $post->ID ) . ">' . get_the_post_thumbnail($post->ID) . '</a></p>' . $content;
return $content;
}
add_filter( 'the_excerpt_rss', 'wptuts_feedimgs' );
add_filter( 'the_content_feed', 'wptuts_feedimgs' );
Nope, that also outputs the URL in plaintext above the thumbnail and links the thumbnail to the front page of your site, just as shown in the image I posted above… Try it, you’ll see what I mean…
The code I linked to previously works exactly as intended 
