title: How to set a post featured image as background image in Wordpress
body: <p>I created a section where I display all my post content. My struggle is now to set the post thumbnail as a background image.</p>
  
  <p>Here the structure of the section:</p>
  
  <pre><code>&lt;section id="testimonials"&gt; 
      &lt;div class="testimonials-container"&gt;
          &lt;div class="heading-container"&gt;
              &lt;h3 class="page-title"&gt;Testimonials&lt;/h3&gt;
          &lt;/div&gt;
          &lt;div class="testimonials-box"&gt;
              &lt;?php 
                  $queryposts = array(            
                      'post__in' =&gt; array(75,73), 
                      'post_type' =&gt; 'post',
                      'posts_per_page' =&gt; -1,  
                      'order' =&gt; 'ASC' 
                  );
                  $lastblog = new WP_Query( $queryposts );            
                  if($lastblog-&gt;have_posts() ):
                      while($lastblog-&gt;have_posts()): $lastblog-&gt;the_post(); ?&gt;
  
                      &lt;div class="testimonial-wrapper"&gt;
                          &lt;div class="testimonial-item"&gt;   
                              &lt;p class="test-content"&gt;&lt;?php the_content(); ?&gt;&lt;/p&gt;
                              &lt;p class="test-title"&gt;&lt;?php the_title(); ?&gt;&lt;/p&gt;
                              &lt;?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post-&gt;ID), 'full' );?&gt;
                              &lt;div class"image-class" style="background-image: url('&lt;?php echo $thumb['0'];?&gt;')"&gt;&lt;/div&gt;
                              &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;?php endwhile;
                  endif;            
                  wp_reset_postdata();
              ?&gt; 
          &lt;/div&gt;  
      &lt;/div&gt;
  &lt;/section&gt;
  </code></pre>
  
  <p>Here my css:</p>
  
  <pre><code>section#testimonials {
      height: 400px;
      background-image: url(images/testimonials-bg.jpg);
      background-size: cover;
      background-repeat: no-repeat;
      text-align: center;
  
  }
  
  .testimonial-wrapper {
      width: 100%;
      max-width: 900px;
      margin: 0 auto;
  }
  
  .image-class{
      display: block;
      width: 125px;
      height: 125px;
      background-size: cover;
      background-repeat: no-repeat;
  }
  </code></pre>
  
  <p>When I try to view the page the image does not show and tying to inspect the page it shows this:</p>
  
  <pre><code>background-image: url((unknown));
  </code></pre>
  
  <p>How can I set the thumbnail as background image of my div box?</p>
  
  <p>Hope you can help</p>