The problem here is the_post_thumbnail()
doesn’t return image url but the img tag.
You can use this code
$url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
echo '<li class="produkt" style="background: url('. $url.')">';
The problem here is the_post_thumbnail()
doesn’t return image url but the img tag.
You can use this code
$url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
echo '<li class="produkt" style="background: url('. $url.')">';