This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Possible uses of new WP RSS Images plugin

By: simonwheatley on May 2nd, 2012  |  syntax: PHP  |  size: 0.81 KB  |  views: 32  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.  
  3. // These functions could go into the functions.php in your theme, or form
  4. // part of another plugin.
  5.  
  6. /**
  7.  * Hooks the WP wp_rss_image_size filter
  8.  *
  9.  * @param  
  10.  * @return void
  11.  **/
  12. function sw_wp_rss_image_size( $size ) {
  13.         $size = 'large-feature';
  14.         return $size;
  15. }
  16. add_filter( 'wp_rss_image_size', 'sw_wp_rss_image_size' );
  17.  
  18. /**
  19.  * Hooks the WP wp_rss_image_alternative filter
  20.  *
  21.  * @param  
  22.  * @return void
  23.  **/
  24. function sw_wp_rss_image_alternative( $false, $post_id ) {
  25.         $post = get_post( $post_id );
  26.         $img_url = $false;
  27.         if ( $thumbnail_id = get_post_thumbnail_id( $post->ID ) ) {
  28.                 $img = wp_get_attachment_image_src( $thumbnail_id, 'small-feature' );
  29.                 $img_url = $img[ 0 ];
  30.         }
  31.         return $img_url;
  32. }
  33. add_filter( 'wp_rss_image_alternative', 'sw_wp_rss_image_alternative', 10, 2 );
  34.  
  35.  
  36. ?>
clone this paste RAW Paste Data