-
-
Save hmps/6027528 to your computer and use it in GitHub Desktop.
Check to discover if a WP-page is a part of the blog 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
<?php | |
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') ) ? true : false ; | |
} | |
?> | |
<?php | |
// Usage | |
if (is_blog()) { echo 'You are on a blog page'; } | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment