Featured Image / Page Thumbnail Is Not Working On Post Page

Share Now

Solution:

<?php if(is_home()) {
    $img = wp_get_attachment_image_src(get_post_thumbnail_id(get_option('page_for_posts')),'full');
    $featured_image = $img[0];
}?>
<div class="banner-image" style="background-image:url('<?php echo $featured_image ?>')"></div>
Picture of Nahid Mahamud

Nahid Mahamud

Web Developer | Graphic Designer | WordPress & Woo-commerce Expert