Last active
December 19, 2015 00:59
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
oops forget '||' between is_search() and is_author()!