WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have my posts page set to a page named Blog. This is set to use the Template: Default template. So index.php is rendering this page. I want to be able to set the Featured image of this page I've called Blog and have this output at the top of the blog posts page on my site. For every other page on my site I am able to acheive this with

<div style="background-image: url('<?php echo $featured_src[0]; ?>');">

Does anyone have any idea why the featued image would work for page.php but not index.php?

share|improve this question
What is the final output (HTML source) on the posts page? Is it an empty inline style attribute? – jdm2112 May 28 '14 at 18:37
this is what I can see when I inspect it: background-image: url(''); but the same image with the same code on page.php give me the image! – Ciarán May 28 '14 at 18:38

when a page is set to be the posts page, then the 'page_for_posts' option will contain the page id of that page; in this case, you can output the featured image with:

if( is_home() && get_option( 'page_for_posts' ) 
 echo get_the_post_thumbnail( get_option( 'page_for_posts' ) );
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.