Created
March 21, 2017 13:06
-
-
Save solid-pixel/62166342d85db3d6469c7e0b1adf9386 to your computer and use it in GitHub Desktop.
Set ACF image (ID) 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 | |
$imgID = get_field('field_slug'); | |
$imgSize = "large"; // (thumbnail, medium, large, full or custom size) | |
$imgArr = wp_get_attachment_image_src( $imgID, $imgSize ); | |
// $url = $image[0]; | |
// width = $image[1]; | |
// height = $image[2]; | |
?> | |
<div id="post-splash" style="background-image: url(<?php echo $imgArr[0]; ?> );"> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment