Featured image as a full size background in div element
-
In the page.php I’m trying to add a div after the header. Inside this div I want the post’s featured image as a full size background-image.
I’ve been looking at various threads, but while some were resolved, I couldn’t make it work.
My webpage: https://rubinreklame.dk/design-til-folket/
Below is some code, where I at least get something online (the alt-text).
<div id="featuredimage"> <?php $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?> <img src="<?php echo $url; ?>" longdesc="URL_2" alt="Text_2" /> <?php ?> </div>
#featuredimage{ width:100%; height:600px; overflow:hidden;}
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Featured image as a full size background in div element’ is closed to new replies.