Where is the WordPress is_blog() Function

- by

At first glance, there appears to be no conditional function to test if we’re on the user’s blog page. Which is weird, since can test so many other things with WordPress Conditionals: is_singular(), is_page() or is_front_page() and is_home(). Sadly we cannot test if the current page is in fact displaying the blog with something like is_blog(). After all this could be neither the home nor the front page.

Or can we?

I wanted to test this condition and display a special layout if true, so at first I thought I had to write my own function to check this. Something like this idea courtesy of Wesbos. Sadly that didn’t work for me.

Turns out the solution is simpler than I thought: is_home() does indeed test for the blog page. From the WordPress Docs:

The blog homepage is the page that shows the time-based blog content of the site.

is_home() is dependent on the site’s “Front page displays” Reading Settings ‘show_on_front’ and ‘page_for_posts’.

If a static page is set for the front page of the site, this function will return true only on the page you set as the “Posts page”.

I had no idea! Perhaps the description is a little misleading. Ah well, learnt somethig new today – I thought I’d share it with you.

Further Reading

Add your voice!

This site uses Akismet to reduce spam. Learn how your comment data is processed.