Skip to content

Instantly share code, notes, and snippets.

@besimhu
Created March 15, 2015 16:05
Show Gist options
  • Save besimhu/4bb93ee7cec9e2fac575 to your computer and use it in GitHub Desktop.
Save besimhu/4bb93ee7cec9e2fac575 to your computer and use it in GitHub Desktop.
Sometimes you just want to have one check that checks if it’s related to the blog. Yes, this uses many functions, so use it as a last resort.
// check if it's a blog page
function is_blog () {
global $post;
$posttype = get_post_type($post );
return ( ((is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag())) && ( $posttype == 'post') );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment