Custom image size with srcset


I am having problem with custom sized srcset. On this page for the DANCE/ARTS/EVENTS section, I selected the WordPress default "Medium Large" size for the thumbnail images. If I check the codes, I can see the images comes with the "srcset" attribute. Please check the screenshot here.

Then I have created a custom image size with the following code:

add_theme_support( 'post-thumbnails' ); add_image_size( 'medium-cropped', 768, 514, true );

I have regenerated all the images with the Regenerate Thumbnails plugin.

Now I have a custom size "Medium Cropped" to select in Elementor page builder. Please check the 4 thumbnails on this page. If you look at the codes, you will not see the srcset for them. Please check the second screenshot here.

Can anyone suggest me the exact code to add in the functions.php file? I have read many tutorials but unable to find a solution.

Anjan Phukan 8 months 2020-12-04T09:10:20-05:00 0 Answers 10 views 0

Leave an answer