I’d like to get a post’s featured image and use it in the style=”background: url()” of the post. I thought this would do it, but alas I was wrong because this outputs the whole (img src=””> stuff.
<div style="background: url(<?php the_post_thumbnail( 'thumbnail' ); ?>
) !important;">adasdasdasd </div>
I tried get_post_thumbnail but don’t think I have the format right.
Any thoughts?
You just need to retrieve the src attribute of the thumbnail:
$thumb_src
is then an array containg the url, width and height of the thumbnail image. So something like…should work.