Site icon Catch Themes

Trying to Set 'Featured Image' as Page Background Image

Hi. I'm trying to set the 'Featured Image' of a single page/post on my site as the background image for that single page, and have any text or content I add to the page be visible *on top* of that background image. I've been looking at ways to customize the single.php file to accomplish this, for example: <?php $backgroundImg = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' );?> <div class="header-wrap" style="background: url('<?php echo $backgroundImg[0]; ?>') no-repeat;"> <header class="entry-header"> <h1 class="entry-title"><?php the_title(); ?></h1> </header> </div> This is my site: www.communitypartnersnh.org Any suggestions would be welcome! Thank you. Kathleen
Exit mobile version