getting url from variable that calls picture of current page, not working. Only displays everything instead of url

Question

I am trying to echo an image to the background like so

$product_pic = get_the_post_thumbnail($pid, 'full');
$pid = $result[0]->productID;

<style>
    .product-pic-bg{background-image:url("<?php echo  $product_pic;?>")}
</style>

It doesn’t work. All I get is .product-pic-bg{url""} in the console.

When I dump the $product-pic I get:

background

What do I do to get this to work?

0
Tom J Nowell 2 weeks 2021-04-25T15:02:03-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse