Skip to content

Instantly share code, notes, and snippets.

@fitzhaile fitzhaile/is_blog.php forked from wesbos/is_blog.php
Created Oct 16, 2012

Embed
What would you like to do?
WordPress is_blog()
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 ;
}
Usage:
<?php 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
You can’t perform that action at this time.