Put Wordpress Thumbnail as background [closed]

0

I need to put the Wordpress thumbnail as a background in a div

Currently with img same, using Loop :: thumbnail ()

    
asked by anonymous 20.09.2017 / 20:57

1 answer

0

You can insert insert the thumbail url into a style inside the div, so every time you change the thumbnail it will change in the background of the div as well:

<div style="background-image: url("<?php echo get_the_post_thumbnail_url(get_the_ID()) ?>");">
</div>

Remember to pass the post id as a parameter to the get_the_post_thumbnail_url () function.

    
24.09.2017 / 19:46