<?php if(is_home()) {
$page_for_posts = get_option( 'page_for_posts' );
echo get_the_post_thumbnail($page_for_posts, 'large');
} ?>



It is common to need a way to get the featured image / title or fields from the blog listing page as by default WordPress passes through all of the posts to this template, meaning functions like the_title() no longer work as in other templates, as the loop is different. This function targets specifically the blog listing page, but does so dynamically to avoid hard-coding by ID.



The is_home check ensures that the page running this code is the WordPress “home” page. This is actually the blog listing page, as rather archaically, WordPress still likes to think of itself as a blogging platform. This part can be removed if this code is going to sit on index.php.

The get_option( 'page_for_posts' ) function will return the ID of the page in WordPress that is set as the blog listing page. The blog listing page aka the ‘posts page’ aka the ‘page_for_posts’ is set in the admin under Settings->Reading->Posts page. The advantage of this method is that the ID of the page does not have to be hard-coded. So the page can be deleted or changed and as long as it is re-set in the settings (as it should be), the function will always find the right ID



Then get_the_post_thumbnail() or whatever other function you care to use will take the ID of a post as the first argument, returning the image for that particular page. This can also be used to get the title, content or any other fields.