Guest User

Untitled

a guest
Aug 5th, 2015
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. <?php
  2.  
  3. $css = "style=''";
  4. if ( has_post_thumbnail( get_the_ID ) ) :
  5. $size = 'large'; // choose size of image to be used
  6. $thumb_id = get_post_thumbnail_id();
  7. $thumb_object = wp_get_attachment_image_src($thumb_id, $size, true);
  8. $thumb_url = $thumb_object[0];
  9. $css = "background-image:url('$thumb_url'); background-size:cover; background-position:top-center no-repeat;"
  10. endif;
Add Comment
Please, Sign In to add comment