Skip to content

Instantly share code, notes, and snippets.

@kovshenin
Created June 26, 2012 14:09
Show Gist options
  • Save kovshenin/2995995 to your computer and use it in GitHub Desktop.
Save kovshenin/2995995 to your computer and use it in GitHub Desktop.
<?php
/*
* Plugin Name: Foo
*/
add_image_size( 'my-rss-thumbnail', 292, 136, true );
add_action( 'rss2_item', 'my_rss2_item' );
function my_rss2_item() {
$thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id(), 'my-rss-thumbnail' );
if ( ! $thumbnail ) return;
$thumbnail = $thumbnail[0];
printf( "<image><url>%s</url><title>%s</title></image>", esc_url_raw( $thumbnail ), esc_html( get_the_title() ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment