Add the Thumbnail To Your RSS Feed

Ask questions and get support about Image River Wordpress Theme

Add the Thumbnail To Your RSS Feed

Postby Kadom » 16 Dec 2009, 13:03

Hello,

To follow an ask from Shanta. I'll give you the hack to add your custom field thumbnail to the RSS Feed.

It's quite easy, In your ImageRiver theme directory find the functions.php file and add the following code at the beginning after <?php markup

Code: Select all
function kd_image_for_feeds( $content ) {

   global $post, $id, $wpdb;
   
   if(get_post_meta($post->ID,'screenshot', true) <> '') {
      $content = '<p>
      <img src="'.get_bloginfo('template_directory').'/thumb.php?src='.get_post_meta($post->ID,'screenshot', true).'&amp;h=180&amp;w=290&amp;zc=1&amp;q=85" alt="" class="center"/>
      </p>'.$content;
      return $content;
   } // End if image
   else {
      return $content;
   }
}

add_filter('the_content_rss', 'kd_image_for_feeds');
add_filter('the_excerpt_rss', 'kd_image_for_feeds');


If you want add the large thumbnail you can modify in the code
get_post_meta($post->ID,'screenshot', true) by get_post_meta($post->ID,'image', true)

You can also modify the size of the image (height and width): h=180&amp;w=290

Best Regards,
Kadom Admin
User avatar
Kadom
Site Admin
 
Posts: 22
Joined: 23 Mar 2009, 12:05

Re: Add the Thumbnail To Your RSS Feed

Postby shansta » 16 Dec 2009, 17:10

Works well.

Cheers
shansta
 
Posts: 10
Joined: 13 Dec 2009, 10:05


Who is online

Users browsing this forum: No registered users and 0 guests