Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #12716

    Is possible to put the preview image thumbnails on the rss feed? I usually use the 610*273 image add field, and i want to put this image on my rss feed (thumbnalil if is possible because 610*273 is too big)

    Thank you

    #76454

    Hi heavymetaller,

    You can try adding this function to the very bottom of your functions.php. Make sure to refresh your browser cache when viewing the rss feed after that.

    // THIS INCLUDES THE THUMBNAIL IN OUR RSS FEED
    add_filter( 'the_excerpt_rss', 'inoplugs_insertThumbnailRSS' );
    add_filter( 'the_content_feed', 'inoplugs_insertThumbnailRSS' );
    function inoplugs_insertThumbnailRSS( $content ) {

    global $post;
    $slides = avia_post_meta($post->post_id, 'slideshow');
    if ($slides){
    $postimage = avia_image_by_id($slides[0]['slideshow_image'],'thumbnail');
    $content = '<div>' . $postimage . '</div>' . $content;

    return $content;
    }
    }

    Regards,

    Devin

    #76455

    Hi, i’ve tried but it is not work. (i’ve cleared the cache) it return me an RSS error in IE and a blank page (with rss header) in Firefox.

    I think that the problem is in the Fetch of the 610*273 img (the preview image on display theme).

    I’ve tried with another code

    //
    function get_my_first_image($content) {
    global $post, $posts;
    $first_img = '';
    $output = preg_match_all('/<img.+src=['"]([^'"]+)['"].*>/i', $post->post_content, $matches);
    $first_img = $matches [1][0];
    $content='<div style="float:left; margin:5px;"><img width="150px" src="'.$first_img.'" /></div>'.$content;
    return $content;
    }
    add_filter('the_excerpt_rss', 'get_my_first_image');
    add_filter('the_content_feed', 'get_my_first_image');
    //
    /* @END Immagini dei post Nei feed */

    And it work but there are one problem, this metod fetch the first image in the post, and the preview image is not in the post but before so this code don’t catch the image. Now i have removed all code because i need a functional RSS for the rss graffiti on facebook.

    I’ve tried to mmodify the code but i have only errors.

    Have you a solution for this?

    #76456

    The code Devin posted above does not work with older themes like Display – try following code instead:

    // THIS INCLUDES THE THUMBNAIL IN OUR RSS FEED
    add_filter( 'the_excerpt_rss', 'inoplugs_insertThumbnailRSS' );
    add_filter( 'the_content_feed', 'inoplugs_insertThumbnailRSS' );
    function inoplugs_insertThumbnailRSS( $content ) {

    global $post;

    $preview_small = get_post_meta($post->ID, "_preview_small", true);
    $preview_medium = get_post_meta($post->ID, "_preview_medium", true);
    $preview_big = get_post_meta($post->ID, "_preview_big", true);

    $preview = $preview_medium;
    $link = true;
    $lightbox = '';
    $link_url = get_permalink();

    if ($k_option['general']['tim'] == "1" && $preview_medium == "")
    {
    $preview = $preview_big;
    }

    $preview = kriesi_build_image(array('url'=>$preview,
    'height'=> '273',
    'width'=> '610',
    'lightbox'=>$lightbox,
    'link'=>$link,
    'link_url'=>$link_url
    ));

    $content = '<div>' . $preview . '</div>' . $content;

    return $content;
    }

    #76458

    hmmm…. rss graffiti is not fetch the image.. is possible that depend by the image too big or not aligned with the text (image on top-left of the text body in the rss)?

    #76459

    I correctedthe code. I’m not familiar with rss graffiti and I can’t say why it’s not using the images. As far as I know the styling and alignment of the image shouldn’t be an issue though.

    #76460

    ok, solved. Thanx a lot.. you can close the post now!

    #76461

    Hi,

    Glad that this is resolved now. :)

    Regards,

    Ismael

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Add image/thumbnails on rss feed’ is closed to new replies.