Advertisement
simonwheatley

Diff for WP RSS Images WordPress plugin

May 2nd, 2012
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.31 KB | None | 0 0
  1. Index: wp-content/plugins/wp-rss-images/wp-rss-images.php
  2. ===================================================================
  3. --- wp-content/plugins/wp-rss-images/wp-rss-images.php  (revision 538837)
  4. +++ wp-content/plugins/wp-rss-images/wp-rss-images.php  (working copy)
  5. @@ -91,10 +91,23 @@
  6.  
  7.  }
  8.  
  9. +/**
  10. + * Returns a URL to an image in the user uploads directory on this server.
  11. + *
  12. + * Developers can hook the wp_rss_image_alternative filter to provide their
  13. + * own image URL on this server, or hook the wp_rss_image_size filter to
  14. + * provide a specific size for the featured_image.
  15. + *
  16. + * @param string $size Defaults to medium, a WordPress image size added with add_image_size
  17. + * @return string The URL to an image on this server
  18. + */
  19.  function wp_rss_img_url($size = 'medium') {   
  20.     global $post;
  21. -   if( function_exists ('has_post_thumbnail') && has_post_thumbnail($post->ID)) {
  22. +   if ( $img_url = apply_filters( 'wp_rss_image_alternative', false, $post->ID ) ) {
  23. +       return $img_url;
  24. +   } else if( function_exists ('has_post_thumbnail') && has_post_thumbnail($post->ID)) {
  25.         $thumbnail_id = get_post_thumbnail_id( $post->ID );
  26. +       $size = apply_filters( 'wp_rss_image_size', 'medium', $post->ID );
  27.         if(!empty($thumbnail_id))
  28.         $img = wp_get_attachment_image_src( $thumbnail_id, $size );
  29.     } else {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement