In cases of older blogs, authors may not have used featured images, but lately, featured images are used more and more as you can use them to handle your blog layout better.
So what do you do on those posts that have no featured image?
This code is a set of functions that I’ve found handy to add to your functions.php.
It will search a post for the first attached image and store it as a featured image. This code also includes functions to check youtube or vimeo if the post has video instead of images:
In your loop.php, or single.php, or anywhere else you use featured images, you would then call it as such: