WordPress.org

Ready to get started?Download WordPress

Forums

WP RSS Aggregator
[resolved] Thumbnails (5 posts)

  1. jennybeaumont
    Member
    Posted 1 year ago #

    Hi Jean,

    Am finally exploring the new version in detail - wow! The conversion to CPTs is really going to open up some possibilities!

    Has anyone posted on adding thumbnails? I perused the recent forum posts but didn't see anything. I had worked this out for the older version, but can quite put my finger on it in this latest one.

    Ideas?
    best,
    -jennyb

    http://wordpress.org/extend/plugins/wp-rss-aggregator/

  2. jennybeaumont
    Member
    Posted 1 year ago #

    After mucking about with get_content to no avail, I finally peeked in on the database and noticed that the thumbnail is already present in wprss_item_description. Now, if only I can figure out how to strip it out and echo it...

    Help welcome :)

  3. jennybeaumont
    Member
    Posted 1 year ago #

    GOT IT!

    The solution pulls from the previous version in that thumbs must first be added to the feed as a function :

    function insertThumbnailRSS($content) {
    global $post;
    if ( has_post_thumbnail( $post->ID ) ){
    $content = '' . get_the_post_thumbnail( $post->ID, 'medium' ) . '' . $content;
    }
    return $content;
    }
    
    add_filter('the_excerpt_rss', 'insertThumbnailRSS');
    add_filter('the_content_feed', 'insertThumbnailRSS');'

    From there I had the following to both of the foreach statements in wp-rss-aggregator.php before the first update_post_meta (tho not sure placement matters much) :

    preg_match_all('/<img([^>]*)>/i', $item->get_description(), $matches);
    $all_images = $matches[0];
    $thumb = $all_images[0];

    Then added a new update_post_meta at the end (for both loops) :

    update_post_meta( $inserted_ID, 'wprss_item_thumb', $thumb);

    Finally in the query section after $source_name I added :

    $thumbnail = get_post_meta( get_the_ID(), 'wprss_item_thumb', true );

    And place $thumbnail in the echo. voilĂ  !!

    Cool thing is, now that these are CPT, we can import into sliders (I use SliderPro, it's the bees knees)!!!

    Thanks again Jean!
    -jennyb

  4. jennybeaumont
    Member
    Posted 1 year ago #

    sidenote: doesn't integrate as well into sliderpro as i would have liked...unfortunately can't use Imported Feeds without Feed Sources, but still room for possibility :)

  5. jennybeaumont
    Member
    Posted 1 year ago #

    scratch that last comment, blog post to follow ;)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic