Site icon Hip-Hop Website Design and Development

wordpress responsive picture srcset not working

I am attempting use wordpress core responsive picture characteristic however it’s not including srcset to picture. Right here is th my codes

I’ve a div w=370px h=280px now I added picture sizes

if(function_exists('add_image_size')){
add_image_size( 'imagebox', 370, 280, true );
add_image_size( 'imagebox-2x', 840, 560, true );
add_image_size( 'imagebox-3x', 1110, 840, true );}

And calling it contained in the loop like this

the_post_thumbnail('imagebox-2x');

it is including solely picture like this 2x model with out srcset

<img width="840" peak="560" src="http://localhost/starter/wp-content/uploads/2018/10/04004_theblackandwhiterocky_2560x1600-840x560.jpg" class="attachment-imagebox-2x size-imagebox-2x wp-post-image" alt="">

If I take away the picture dimension from the_post_thumbnail and use it solely the_post_thumbnail(); it is working with responsive pictures however with out my sizes

<img width="180" peak="180" src="http://localhost/starter/wp-content/uploads/2018/10/04004_theblackandwhiterocky_2560x1600-180x180.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="" srcset="http://localhost/starter/wp-content/uploads/2018/10/04004_theblackandwhiterocky_2560x1600-180x180.jpg 180w, http://localhost/starter/wp-content/uploads/2018/10/04004_theblackandwhiterocky_2560x1600-150x150.jpg 150w" sizes="(max-width: 180px) 100vw, 180px">

How can I repair this?