Last active
October 27, 2015 14:11
-
-
Save mattradford/2f367a0d7610ce91a824 to your computer and use it in GitHub Desktop.
Featured image as background
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 | |
if (has_post_thumbnail()) { | |
$image_data = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), "large" ); | |
echo '<div class="page__featured-image" style="background-image: url('.$image_data[0].');"></div>'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment