• Resolved nineplanetsllc

    (@nineplanetsllc)


    We have this plugin to output feeds from other sites, but it’s apparently adding featured images to our own feed as well. We’re trying to figure out how to change the image size added to our feed, it’s too large and we’d prefer to have the size be a thumbnail instead. How can we adjust that?

Viewing 1 replies (of 1 total)
  • Thread Starter nineplanetsllc

    (@nineplanetsllc)

    This is resolved now. For anyone having the same trouble and finding this post in the future, this code added to your functions.php will swap out the image for the thumbnail:

    remove_filter('the_excerpt_rss', 'wp_rss_retriever_add_thumbnail_to_rss');
    remove_filter('the_content_feed', 'wp_rss_retriever_add_thumbnail_to_rss');
    add_filter('the_excerpt_rss', 'wp_rss_retriever_add_custom_thumbnail_to_rss');
    add_filter('the_content_feed', 'wp_rss_retriever_add_custom_thumbnail_to_rss');
     
    function wp_rss_retriever_add_custom_thumbnail_to_rss($content) {
        global $post;
        if ( has_post_thumbnail( $post->ID ) ){
            $content = '' . get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'float:left; margin:0 15px 15px 0;' ) ) . '' . $content;
        }
        return $content;
    };
Viewing 1 replies (of 1 total)
  • The topic ‘Image size in RSS Feed’ is closed to new replies.