WordPress.org

Support

Support » Plugins and Hacks » WP RSS Multi Importer » [Resolved] Featured Images use

[Resolved] Featured Images use

  • greekdish

    @greekdish

    Can this plugin include the ability to use Featured Images of posts first, if available, then first available image in post?

    Im finding the first avilable image not working if there is text before the image. Its very inconsistent in reading the images from the excerpts….half the time it doesnt pick them up.

    http://wordpress.org/extend/plugins/wp-rss-multi-importer/

Viewing 15 replies - 1 through 15 (of 26 total)
  • Plugin Author Allen

    @amweiss98

    Right now, it picks up the very first image in the content and if that’s not there it then looks to the enclosure to see if an image is there.

    If there are words before the first image, it won’t pick up the image. This was made necessary because otherwise a lot of the images that would be picked up are advertisements.

    Perhaps you could leave an example RSS feed where you are having this problem so I can see what’s going on.

    greekdish

    @greekdish

    Hi Allen, thanks for responding.

    Yes, it was indeed text being before the image. Is there an easy way to change that functionality in the code, to use any image regardless if text before it?

    Plugin Author Allen

    @amweiss98

    Well, that would require having a rule of some sort, so one can write a program. It’s not clear what that rule would be without bringing in all types of potential problems. For example, would the first sentence always end in a period. Or maybe an exclamation point, etc Would you discard the first sentence, etc. this has to be clarified to make this possibly work.

    greekdish

    @greekdish

    Hi Allen,

    I found a solution thats works great. I added this to my functions.php file…

    //add post thumbnails to RSS images
    function cwc_rss_post_thumbnail($content) {
        global $post;
        if(has_post_thumbnail($post->ID)) {
            $content = '<p>' . get_the_post_thumbnail($post->ID) .
            '</p>' . get_the_excerpt();
        }
    
        return $content;
    }
    add_filter('the_excerpt_rss', 'cwc_rss_post_thumbnail');
    add_filter('the_content_feed', 'cwc_rss_post_thumbnail');

    This puts my post-thumbnail into the RSS feed, which crops images to a set height and width. I just had today a client add an image into a post with a size of 620 x 4477. Yes, 4,477 pixels high, an infographic. That was a disaster in the feed. This way, Im able to use WordPress’ built in cropping of featured images to throw into the feed.

    Maybe there is some way you can add that to your plugin code as an option?

    Thank you, your plugin works awesome now.

    Plugin Author Allen

    @amweiss98

    So, this is what you are using in the RSS feed for people to subscribe to from your site? If so, it’s straightforward, as your code shows to take something from wordpress and put it into a feed. The problem is the other way around, since the feeds that come in have no consistent structure, aside from the RSS tags. My plugin can easily get images that are in enclosures, and those that come first in the description and content tags, it gets tricky when the image comes after a bunch of text. Now, this isn’t a problem for someone who wants all the content in the tag (that’s why I have a “Give Me Everything” option), but that’s a dump of the entire contents, rather than nicely selecting the image and floating it to the left, etc.

    Now, finally, if you’re going to input your own feeds onto your site, you have a lot more control, but this would simply require changing my code to know where the images are, etc.

    greekdish

    @greekdish

    Its not for people to subscribe to. Its actually to be an rss aggregate for the multisite blogs, and to then use the shortcode on the landing page to have 4 feeds combined as a portal page.

    Plugin Author Allen

    @amweiss98

    oh..interesting…people could actually use my plugin to combine the feeds from blogs and put on the first page (that’s how I’ve used it). Ok, let me see if it’s possible to do something…thanks

    Plugin Author Allen

    @amweiss98

    also, can you give me an example of an RSS feed that you know of that exemplify having the image after text so I can see if I can provide this option.

    Plugin Author Allen

    @amweiss98

    ok..I think i have a solution…are you interested in trying it out? I would send you a replacement for one file.

    greekdish

    @greekdish

    Sure. Sounds good

    Plugin Author Allen

    @amweiss98

    ok…contact me at

    http://www.allenweiss.com/contact

    and I’ll send you a replacement file that will pick up the first image it finds if it can’t find one in the enclosure or the leading image.

    greekdish

    @greekdish

    Thank you Allen for the wonderful work!

    Hello Allen. I’m having the same “problem” that Greekdish was having. My thumbnails show up on the individual page FEEDS but it doesn’t show up on the home page. How did you resolve this?

    Hello Greekdish where did you enter that code? I would like to try it out.I’m not as php savvy as you two but I learn quickly.

    My blog is http://www.mobtreal.com

    Thank you both for your time!
    Cheers

    Plugin Author Allen

    @amweiss98

    Have you downloaded the most recent version (2.51)?

    I just did. I clicked the download 2.51, extracted but how do I get it update on ,WP?

Viewing 15 replies - 1 through 15 (of 26 total)
  • The topic ‘[Resolved] Featured Images use’ is closed to new replies.
Skip to toolbar