Conditionally Show Only On Home Page (Front Page)

There a are two functions that are used quite a bit to conditionally show content on the very front page (home page or page 1 of your blog). First – we had the function is_home(), but in WordPress version 2.5 – a new function was introduced: is_front_page().

You might think both would conditionally only display content on the home page (front page, page 1 of your blog) – but you actually need to use the following code to accomplish showing something ONLY on the front page of your paged blog:


<p>Show this text only on the home page</p>

So – if you want to easily show something on what I would consider the front page – use the code above to successfully achieve that. (This is particularly helpful if you have ads that run speficically on the home page and others that are ROS (run of site).

Further reading:

New Condition Tag: is_front_page() (WordPress 2.5)

Great news for WordPress theme developers. WordPress 2.5 now offers a new conditional tag: is_front_page(). We have long lived with other options (is_page(‘home’)) or other logic like that, but the is_front_page() simplifies defining the “home page” in our templates. Thanks guys!