You can do this using the ‘the_content’ filter:
add_filter( 'the_content', 'insert_featured_image', 20 );
function insert_featured_image( $content ) {
$content = preg_replace( "/<\/p>/", "</p>" . get_the_post_thumbnail($post->ID, 'post-single'), $content, 1 );
return $content;
}
Of course, you can add options to the the_post_thumbnail() function to define which size of thumbnail you’d like to use, etc… http://codex.wordpress.org/Function_Reference/the_post_thumbnail
Related Posts:
- How to replace the_post_thumbnail template tag and show the first inside the post image instead
- Adding schema itemprop image to the_post_thumbnail with filters
- How to show a featured image as current?
- Can I insert the feature image inside the content, after any paragraph?
- Custom image size in the_content loop
- Add filter on certain thumbnail sizes only
- Get featured image from post on RSS feed
- changing size image within the content
- Plugin scans for images in post_content, how about “featured image”?
- Add class name to post thumbnail
- Delete original image – keep thumbnail?
- the_post_thumbnail responsive srcset not populating with custom image size
- Set custom name for generated thumbnails
- How to add multiple image sizes of the same size with add_image_size
- change set_post_thumbnail_size according to post type admin page
- Can’t extract and set SVG dimensions
- Insert Custom HTML After Shortcode
- How to crop thumbnail height to auto with set width
- Skip posts without a thumbnail in loop
- get_pages – Display child then grandchild pages
- Resizing Images to lower Disk Space Using Plugins
- Set (featured) thumbnail for post?
- How to make thumbnail images click into blog posts
- display WP image posts in Bootstrap 4 modal
- Customising the size of images served in Visual Composer elements [closed]
- What functions are included in apply_filter(‘the_content’)
- How to scale up post thumbnails/featured image?
- Get Ancestor featured image
- Upload 3 different featured image sizes to WordPress
- Change size of featured image in Edit Post screen
- Thumbnail and Featured Image With Fixed Sizes?
- Replacing with(out) regex link to attachment by links to files
- Proper use of the_content filtering
- the_post_thumbnail ignores size parameter
- Is there a way to change a post’s thumbnail image(s)?
- Confused with the loop and repeating things
- WordPress thumbnail settings change
- Using concatenate with WordPress Thumbnail
- Looking for Add Title Tag on Feature Images on WP
- embed the_content
- Modify Image Source With The_Content Filter?
- Is it possible to nest get_previous_post()?
- Notice: Trying to get property of non-object when trying to get thumbnail URL
- Output post thumbnail (add class)
- How to set an equal image size for a Fallback Image as used for the Featured Image(dynamicly)
- How can I see where in my themes and plugins certain image sizes are used?
- Proper way to replace the_content only for pages created by custom plugin
- Display featured image file size, extension, filename, type, orientation?
- Video playing from featured image?
- get_the_post_thumbnail(‘thumbnail-name’) always returns empty string
- array set title and alt in the_post_thumbnail
- Get thumbnail image according to the screen
- Displaying Post Featured Images on All Pages
- Image Alignment on Featured Images
- Trying to show link “Use as featured image” from Attachment window from t31os script
- Use Featured Image of Post as Header Image
- How to display featured image description and title?
- the_content(); erroneously closing off previous opening before it
- get_post_thumbnail does not display thumbnail
- Make image full width
- Facebook Does Not Grab Correct og:Image
- WordPress 4.4 responsive sometimes doesn’t work
- get_the_post_thumbnail($post->ID, ‘thumbnail’); not working. How can I solve this?
- Is it possible to add the_post_thumbnail to style.css?
- Different thumbnails for index and article page
- Why does apply_filters behave different inside and outside a loop?
- Smaller thumbnail in the_content
- Unable to set Custom “Link URL” for Featured Image, and More?
- On what point (hook) does the_/has_post_thumbnail() load?
- First Image not loading on Mobile Version of Website
- Thumbnails not being generated for PDF files
- How to apply filter on get_the_post_thumbnail()
- Make 1st Slide of PowerPoint file to be the Post thumbnail preview image
- Is it possible to set Featured Image using HTML?
- Set featured image from auto generated video thumbnail url php
- Use Post Title as alt text for Featured Image
- Remove External Links from WordPress posts Using add_filter() in Theme functions.php
- How to cropped thumbnail image without distorting it?
- WordPress default srcset with hard crop
- Custom signature appears twice on page
- Shortcode to eliminate and replace with
- How to add content with a filter when there’s no content in the editor
- wp_get_attachment_metadata()[‘image_meta’] fetch WP metadata or EXIF?
- White Blank screen and issue to get thumbnail in
- Set Featured Image Based on Custom Field
- Post thumbnail on specific template
- Suppress the_content filter in a nested loop
- How to have featured image show in standard RSS Widget
- Link from Thumbnail to Post not working
- How to import linked images and make them featured -> automagically
- Change role’s settings influence post-thumbnail
- Wrap Featured Image in a Link
- Thumbnail images
- Featured Image Thumbnail Sizing
- Featured Image Isn’t showing with cropped, How to show it?
- How to modify Media Library images DPI [ image quality down to make small in size ] [closed]
- How to add text & call to action button to featured image on homepage?
- Featured image as background in a div using headway
- php code for image fetching
- Strange image artifact on font-page thumbnail image