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.

So I have a mailchimp email that goes out and shows the latest posts that have been made on the site. The users on the site all have gravatars and I want to include that in the rss feed so that I can point the mailchimp image reader to them.

I have tried using snippets like:

<?php echo get_avatar( get_current_user_id(), 48 ); ?>

or

<?php echo get_avatar( get_author_email(), 48 ); ?>

and adding that to the rss template in /wp_includes (I would love to do it in functions.php but honestly I just want it to work for this one site so I don't care how I get it done).

It's curious because when I do searches I can only find people trying to figure out how to remove it instead of insert it... I am at a loss.

share|improve this question

1 Answer 1

The point is, that the format have no tags for a image to a user. You must use a other tag to inlcude the avatar of a author, not the author tag. The author tag is only for a string, not markkup or images. But you can add content ot the desciption and this is easy on the filter the_content_feed.

A small example, there add content to this part in the feed.

add_filter( 'the_content_feed', 'fb_plugin_function_name' );
/**
* @param  $content Content of post
* @return string
*/
function fb_plugin_function_name( $content ) {

   $content .= 'Total ' . str_word_count( $content ) . ' words';
   return $content;
}
share|improve this answer
    
Not entirely following what you are suggesting. I found this snippet: / Put post thumbnails into rss feed function wpfme_feed_post_thumbnail($content) { global $post; if(has_post_thumbnail($post->ID)) { $content = '' . $content; } return $content; } add_filter('the_excerpt_rss', 'wpfme_feed_post_thumbnail'); add_filter('the_content_feed', 'wpfme_feed_post_thumbnail'); do you know how I could modify this for a gravatar post? –  irishcoffee Jan 30 '13 at 21:46
    
yes, but the thumbnail have a other job. It is a enhancement for the post content, the avatar is a identify for a auther. A feed is xml, a semantic markup and each tag have a description from the definition. Your code is like the same as my example inside the answer. But I will write abiut the topic, there is fine, that you think about the job of the tag inside the xml of feed. You can add a avatar to the content, but it have no semantic importance. –  bueltge Jan 31 '13 at 19:22

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.