i actually just finished working on a site that needed images in his feeds so i ended up using this:
function ba_post_image_feeds($content) {
global $post,$posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
$first_img = $matches [1] [0];
if(!empty($first_img)){
$content="<div>" . $first_img . '</div>' . $content;
}
return $content;
}
add_filter('the_excerpt_rss', 'ba_post_image_feeds');
add_filter('the_content_feed', 'ba_post_image_feeds');
Related Posts:
- Can’t Display Featured Image in RSS Feed
- Change the RSS feed image
- force feed readers to pick atom version
- How to add image in rss?
- Forcing absolute src links in the RSS feed
- Get content from one WordPress website to another
- Filter to remove image dimension attributes?
- Stop wordpress from hardcoding img width and height attributes
- How to automatically add rounded corners to thumbnails?
- WordPress adding scaled images that don’t exist (1536×1536 and 2048×2048)
- Is there a hook which fires after all thumbnails are generated?
- Featured image shortcode
- How to find attachment by it’s name?
- Displaying images from external RSS feeds?
- Cropped featured image replaces original image in gallery
- Image Scaling using get_the_post_thumbnail issue in WordPress
- Remove title attribute from images
- How to create thumbnails with a fixed width, so all of them will have the same width?
- How to limit number of images being printer out in “Set Featured Image” pop up?
- Black and White thumbnails
- How can I add the “Use as featured image” to a custom metabox?
- Double thumbnails?
- No srcset for hard-cropped thumbnails
- Download button for Featured Image in every post – automatically
- Removing Title Tag from Thumbnails
- Display the first image from a post in RSS feed
- Show prev and next post links for parent post of current image in attachment page?
- Get original image from thumbnail URL
- How to check if user is uploading/setting an image as a featured image?
- attach unattached featured images to respective posts
- WordPress reduces the full size image and uses it as the original
- Thumbnails are bigger in size than the original image
- Remove image classes from post thumbnail output
- Exclude featured image from gallery in wp-admin
- Special purpose photos with each post
- SVG Featured image not shown in twitter
- Featured images not displaying at full resolution
- WordPress crops images differently on retina screens?
- How do I create an alternate RSS feed for tags with custom image sizes for MailChimp?
- Update old Post image metadata to ‘thumbnail’ wp_attached_file
- WP keeps looking up post thumbnail on https even though wp-config says http
- Images stopped loadding after adding SSl
- How to replace images?
- Fixing image names for a site being restored
- How do I remove featured images and captions from a wordpress RSS feed?
- Setup Featured image on all posts from thesis thesis_post_image custom field?
- Export xml use/import images from theme directory
- Get custom thumbnail sizes [duplicate]
- Should I not compress my jpeg files before uploading to avoid double compression?
- Custom responsive ‘featured image’ sizes
- Modify RSS – remove image and add text
- Is it possible to preserve original images in order to change image size later?
- the_post_thumbnail(‘medium’) setting some images width=1 height=1
- Generating a certain sized thumbnail on the fly?
- How do you import images from a URL in your post?
- How to set uploaded image as featured image wordpress
- What can i do add title to ‘large’ image?
- Retrieve Image Attachments Getting Post Thumbnail Image First
- Height and width attribute not setting by the_post_thumbnail
- add_image_size function not working
- How to force WordPress to upscale images?
- What sense makes medium_large_size_h => 0?
- How to set minimum required size for featured image?
- All Images not calling alt text
- How do I link a featured photo to it’s post?
- Can we use featured image as third party website image URL
- remove enclosure url from feed
- Is it possible to enable the ‘Link To’ field under ‘Attachment Display Settings’ for a Featured Image?
- Show (print) featured image all dimensions (height, width)
- Use default image as var
- add_image_size not working
- Serve different images per screen size and cache possible?
- Product Images Low Quality After Updating From WP 3.5 to 4 [closed]
- Convert featured images into “product images”
- Resize uploaded images [duplicate]
- How do I display the featured image from an image gallery using a reference in code? (example within)
- How to use the thumbnail size with catch_that_image
- Using different size thumbnails on different parts of my site… with functions.php?
- Thumbnail and image management
- attach several images to post + gallery
- my featured image of wordpress are not showing in the front end though image are uploaded in media library
- How to change Gallery image url in product page ? In function.php?
- How is called this thumbnail slider feature
- Custom image size not displaying with wp_get_attachment_image()
- How to delete original image file after upload and resize
- An error has occurred during the upload process in wordpress version 5.3.2
- Force WordPress to always generate a thumbnail for original image
- Show featured image in all posts
- Get post thumbnail in specific size
- How to set a post featured image from an already made custom field
- featured image in custom poste type (backend)
- Custom Background for each page and post
- Using custom field to change alt text for a featured image
- How to display image thumbnails on the search results page?
- Declare global variable that can be used on other function
- Get custom size of thumbnails
- Black and White Thumbnail in WordPress Gallery
- Getting top Image From the Gallery and printing out a thumbnail with Exact Dimensions
- How can I use an image from an external source without uploading it to the media library
- Edit multiple posts featured image