WordPress.org

Forums

WP RSS Multi Importer
[resolved] Featured Images use (27 posts)

  1. greekdish
    Member
    Posted 2 years ago #

    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/

  2. Allen
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  3. greekdish
    Member
    Posted 2 years ago #

    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?

  4. Allen
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  5. greekdish
    Member
    Posted 2 years ago #

    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.

  6. Allen
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  7. greekdish
    Member
    Posted 2 years ago #

    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.

  8. Allen
    Member
    Plugin Author

    Posted 2 years ago #

    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

  9. Allen
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  10. Allen
    Member
    Plugin Author

    Posted 2 years ago #

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

  11. greekdish
    Member
    Posted 2 years ago #

    Sure. Sounds good

  12. Allen
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  13. greekdish
    Member
    Posted 2 years ago #

    Thank you Allen for the wonderful work!

  14. jjspress
    Member
    Posted 2 years ago #

    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

  15. Allen
    Member
    Plugin Author

    Posted 2 years ago #

    Have you downloaded the most recent version (2.51)?

  16. jjspress
    Member
    Posted 2 years ago #

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

  17. jjspress
    Member
    Posted 2 years ago #

    got it

  18. Allen
    Member
    Plugin Author

    Posted 2 years ago #

    updated in the admin section of WP..go to the plugins in wp and if you already have my plugin you should see something that indicates there is an update..just follow the instructions to update it.

  19. jjspress
    Member
    Posted 2 years ago #

    Ok so it's up to date but still no thumbnail on landing page.

  20. Allen
    Member
    Plugin Author

    Posted 2 years ago #

    then I need to see and example of the RSS url that you are using that is causing this..it's the only way I can possibly figure out if this is a problem with the feed or my plugin.

  21. jjspress
    Member
    Posted 2 years ago #

  22. Allen
    Member
    Plugin Author

    Posted 2 years ago #

    Those are the urls, what I need are the RSS feeds (which I assume you are correctly using in the plugin...you need to use the RSS feeds

  23. greekdish
    Member
    Posted 2 years ago #

    jjspress..... make sure you enter the correct feed URL, for example, the first link's feed is....

    http://feeds.feedburner.com/Tujohaha

  24. Allen
    Member
    Plugin Author

    Posted 2 years ago #

    thanks greekdish, and the last link is

    http://www.slogan1969.com/fr/blog/feed/rss.html

    which I've confirmed is fine and able to bring in images.

  25. jjspress
    Member
    Posted 2 years ago #

    yeah I put in the feeds. I wasn't thinking. lol
    All images appear perfect on the FEEDS page but on the home page no.
    It's probably just some refreshing needed...
    I will respond tomorrow with results/

    Thank you very much for your help!

    Jo

  26. jjspress
    Member
    Posted 2 years ago #

    Hello! So on the feeds page its fine but on home page , I still cant get the thumbnails up? Any suggestions?

  27. Allen
    Member
    Plugin Author

    Posted 2 years ago #

    Well, this must be something going on with your theme or something...I took one of your feeds and put it in the feed to post, and it posts fine on the page.

    http://www.allenweiss.com/feed-to-post-page/

    Since I can't reproduce the problem on my production server, I can only assume it's something in your WP theme or the configuration for blog posts on your home page that is creating the problem.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.