Skip to content

Instantly share code, notes, and snippets.

@SimonPadbury
Last active January 1, 2016 17:47
Show Gist options
  • Save SimonPadbury/b48aa4c4e64e2b364561 to your computer and use it in GitHub Desktop.
Save SimonPadbury/b48aa4c4e64e2b364561 to your computer and use it in GitHub Desktop.
WordPress: Using featured images (thumbnails) as hero backgrounds (1 of 2).
<?php $hero = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' ); ?>
<div class="hero-background-image" style="background: url('<?php echo $hero['0'];?>') center top no-repeat;">
<!-- Put your loop <header> in here. -->
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment