If (for some reason) you have the need to get the featured image (or post thumbnail) URL, you can do it with wp_get_attachment_image_src() function, for example like this:
1 2 3 4 5 |
<?php if (has_post_thumbnail( $post->ID ) ): ?> <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID, 'full' ), 'single-post-thumbnail' ); ?> <div id="custom-bg" style="background-image: url('<?php echo $image[0]; ?>')"> <?php endif; ?> </div> |