Skip to content

Instantly share code, notes, and snippets.

@madysondesigns
Created April 4, 2013 00:29
Show Gist options
  • Save madysondesigns/5306705 to your computer and use it in GitHub Desktop.
Save madysondesigns/5306705 to your computer and use it in GitHub Desktop.
WordPress blog check
//finally have a function to check if we're anywhere on the damned blog and only the blog
function is_blog() {
if ( get_post_type() == 'post' || is_post_type_archive( 'post' ) ) {
$blog = is_home() || is_archive() || is_single();
return $blog;
}
}
@mtekk
Copy link

mtekk commented Apr 4, 2013

One thing to note, you may want to have a return false; after the closing brace for the if statement, always safer to be explicit rather than let PHP decide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment