Here is the example inside a loop. Maybe yours looks a little different but essentially where you find have->posts()
you’ll see a loop. In this block I just created a div and set the style to use the featured image as the background.
// WP_Query arguments
$args = array (
'numberposts' => -1
);
// The Query
$query = new WP_Query( $args );
// The Loop
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
// get the featured image
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'full' );
if( empty( $thumb ) ) continue;
$thumb_src = $thumb[0];
$thumb_width = $thumb[1];
$thumb_height = $thumb[2];
// apply the background image as a style on a div
echo "<div style=\"width: {$thumb_width}px; height:{$thumb_height}px; background-image: url('{$thumb_src}');\" ></div>";
}
} else {
// no posts found
}
// Restore original Post Data
wp_reset_postdata();