Friday, 31 May 2013

Insert featured image in div style background

<?php
if ( has_post_thumbnail()) {
   $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large');
   echo '<div style="background:url(' . $large_image_url[0] . ') no-repeat;"></div>';
}
?>
 
 this returns a <img scr source when opening in chrome, how go i get 
the the_post_thumbnail to just give me the source of the file without 
<img scr?
 
 
<div id="container">
  <div id="gigpres"> 

<div style="background: url(<img width="150" height="150" src="http://xxxx/the-2-live-crew-150x150.jpg" class="attachment-thumbnail wp-post-image" alt="the-2-live-crew" title="the-2-live-crew" />) !important;">adasdasdasd </div>
  </div>
  </div> 

No comments:

Post a Comment