wordpress post thumbnail in css style

I am making a new wordpress theme while working with header slider (i used BXslider) i stuck on inline css thing
I wanna use this code

but i am unable to use the_post_thumbnail($size) under style=’background-image: url(the_post_thumbnail($size));’>

my code is

while($slider->have_posts()): $slider->the_post();
    $myimg = get_post_thumbnail('myslider');

    echo "<li class='featured-post'  style='background-image: url('$myimg');'>";
    echo "</li>";
endwhile; wp_reset_postdata();
echo "</ul>";

Read more here: wordpress post thumbnail in css style

Leave a Reply

Your email address will not be published. Required fields are marked *