Created
August 24, 2017 13:21
-
-
Save corilam/b8aa8755d00a14548eb2c7dbde76b1bb to your computer and use it in GitHub Desktop.
Wordpress Background Image Using Featured Image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'slideshow' );?> | |
<div style="background-image: url('<?php echo $thumb['0'];?>');" class="large-header-image"> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Set up a background image using the WP Featured Image. This uses a custom size called 'slideshow', but change to fit the size you're working with. You'll also need to create a class, here called 'large-header-image' to display the area's height and width.