Hide featured image if there isnt' one
-
I have a website with the code
<?php $image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?> <div id="featuredimage" style="background-image: url('<?php echo $image; ?>')"> <?php ?> </div>
which give every page and post featured image space, even if they don’t have one. How do I make sure this div will only show when the post/page have an image to show?
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Hide featured image if there isnt' one’ is closed to new replies.