Setting “Posts Page” default no longer displays featured image
-
Hello,
I’m setting this variable in my header.php so I can grab the featured image associated with the page and display as the header background image.
<?php $hero = wp_get_attachment_image_url( get_post_thumbnail_id($post->ID), 'full' ); var_dump($post->ID)?>
<header class="<?php echo $class_names;?>" style="background-image: url('<?php echo $hero;?>');">
It actually works great on my static home page template and other pages because I’m able to set the feature image on that page, but as soon as I set my “Reading Settings” for my “Posts Page,” my default blog page (index.php) attempts to grab the first post id, which is the ID (1), the first post that comes with a clean WordPress install, “Hello World.”
I assume this is happening because after selecting your default blog page, the page locks out the option to select a featured image so it goes searching for an ID. With that said, should I create a template for my blog page so I have more control over what is displayed on the page? Is there a way to get the featured image to show up on the default blog page? I hope that makes sense. Thanks!
The page I need help with: [log in to see the link]
- The topic ‘Setting “Posts Page” default no longer displays featured image’ is closed to new replies.