Is_home: Conditional for Blog Page

It is counter-intuitive, but yes, you have to use is_home if you want to refer to your blog page in a conditional – even if the blog is not in your home page.

Lets say you want to add a different image to the header only on your blog page. You would write something like:

if ( is_home()) {
    <img class="header-image" alt="" src="&lt;?php bloginfo('stylesheet_directory'); ?&gt;/images/myimage.jpg" />

What I would call the ‘home page’ is actually called the front page, as in ‘is_front_page()’.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *