Add an “is_blog” Feature to WordPress

If you use WP as a content management system and a blog, you’ve probably wished there was a way to only show particular types of content on blog-related pages.

function is_blog() {
if (is_home() || is_singular('post') || is_post_type_archive( 'post' ))
return true;
else return false;

If you implement this on your own site, you may want to rename the function to something like “is_my_blog()” just in case WordPress ever decides to come up with one of these on its own.

Up Next: WordPress Canonical URLs Done Right