Last active
March 31, 2016 14:56
-
-
Save timstl/c3320081593e080bb596240279647061 to your computer and use it in GitHub Desktop.
Determine if currently viewing a WordPress blog page (home, archive, search, single post).
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
<?php | |
function is_blog_page($single=true, $four04=true) { | |
if ((is_home() || is_archive() || is_search()) && !is_post_type_archive()) { | |
return true; | |
} | |
if ($single === true && is_singular('post')) { | |
return true; | |
} | |
if ($four04 === true && is_404()) { | |
return true; | |
} | |
return false; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment