Skip to content

Instantly share code, notes, and snippets.

@versluis
Forked from wesbos/is_blog.php
Last active September 4, 2020 18:59
Show Gist options
  • Save versluis/5c69de90921e4863c40b698aaba25fa3 to your computer and use it in GitHub Desktop.
Save versluis/5c69de90921e4863c40b698aaba25fa3 to your computer and use it in GitHub Desktop.
WordPress is_blog()
<?php
function guru_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 ;
}
if (guru_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