I have this line of code :
$out .= get_the_post_thumbnail('', '', array( 'alt' => the_title_attribute (array('echo' => 0) ), 'class' => 'img-responsive', 'srcset' => get_the_post_thumbnail_url( "xs" ) ) );
Which is wrong (in respect to the srcset attribute implementation) I'm trying to add srcset/sizes to this, and I'm sure I could do it the easy way and just do as I would normally and add all of the sizes/image sizes manually but this would create several unnecessary lines of code and after doing some research I've come across functions like
And I believe they would be better to use but after doing some research I haven't been able to find a conclusive way of implementing them, the furthest I've gotten is to see the srcset attribute appear but having empty quotes.
I've also seen someone mention that if the uploaded image sizes don't have an identical aspect ratio as the original image that none of these functions will work. If anyone has any example/advice I could refer to for adding
srcset an ajax-served image, I would be very greatful.