Why doesn’t get_post_thumbnail function output the url of the thumbnail?

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
http://jsfiddle.net/0nj2ry4n/1/

However, I am unable to use the_post_thumbnail($size) inline css background

<li 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: Why doesn’t get_post_thumbnail function output the url of the thumbnail?

Leave a Reply

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