So for all of the other pages on my wordpress site I am able to display the featured image for the page. However, on the page that all of my posts are displayed the featured image does not display even if it is set.
Here is the code I am using to display the featured image on all other pages.
This does not work on the page that is chosen to display posts though. Keep in mind that I need to display the featured image as a background image so that it is full width of the page and not stretched. (IE and Edge don't support "object-position" so this is my way of working around that)
Let me know if anything is not clear.
Here is the code I am using to display the featured image on all other pages.
Code:
<?php if ( has_post_thumbnail() ): {
$src = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
}?>
<div class="featured-image-full-width" style="background-image: url( <?php echo $src; ?> ) !important; height: 400px; background-size: cover; background-repeat: no-repeat; background-position: center;"></div>
<?php endif; ?>
This does not work on the page that is chosen to display posts though. Keep in mind that I need to display the featured image as a background image so that it is full width of the page and not stretched. (IE and Edge don't support "object-position" so this is my way of working around that)
Let me know if anything is not clear.