How to use SRCSET with get_the_post_thumbnail()?
My wordpress theme uses get_the_post_thumbnail() to display Thumbnails on Posts.
I have set custom image sizes but running it through Lighthouse gives following error.
Serves images with low resolution Image natural dimensions should be proportional to the display size and the pixel ratio to maximize image clarity.
My innitial approach was to set Serves images with
get_the_post_thumbnail($ID, 'large');
This effects my largest contentful paint and increases page size, thus impacting my performance.
I need to strike a balance.
So is their a way to include multiple thumbnail sizes, and let wordpress choose the one thats best for user display and show the perfect size to user?
Topic thumbnails post-thumbnails php html theme-development Wordpress
Category Web