Featured Image / Page Thumbnail Is Not Working On Post Page

Share Now

Share on facebook
Share on pinterest
Share on twitter
Share on linkedin
Share on email

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>
Nahid Mahamud

Nahid Mahamud

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