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


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: