×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
2
Language: PHP
Posted by: Nicole Patten
Added: Feb 17, 2016 7:58 PM
Modified: Feb 17, 2016 7:59 PM
Views: 28
  1. <?php while ( have_posts() ): the_post();
  2.         $thumb_id = get_post_thumbnail_id();
  3.         $thumb_url = wp_get_attachment_image_src($thumb_id,'large', true);
  4. ?>
  5.  
  6. <div class="post-image" style="background-image:url(<?php echo $thumb_url[0] ?>)">
  7. </div>

1 comment

kanon chowdhury 6 months ago
Thanks, this snippet save my time!

Write a comment