Skip to content

Instantly share code, notes, and snippets.

@micahblu
Last active December 19, 2015 00:59
Show Gist options
  • Save micahblu/5872893 to your computer and use it in GitHub Desktop.
Save micahblu/5872893 to your computer and use it in GitHub Desktop.
A simple WordPress method that lets us know if were on a blog page or not
/**
* is_blog
*
* A simple method that lets us know if were on a blog page or not
*
* @return bool
* @since 0.7
*/
function is_blog () {
global $post;
$posttype = get_post_type($post );
return ( ((is_archive()) || (is_search()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag())) && ( $posttype == 'post') ) ? true : false ;
}
@micahblu
Copy link
Author

micahblu commented Jul 2, 2013

oops forget '||' between is_search() and is_author()!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment