Skip to content

Instantly share code, notes, and snippets.

@wesbos
Created September 2, 2011 19:32

Revisions

  1. wesbos revised this gist Sep 6, 2011. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion is_blog.php
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    function is_blog () {
    return ( (is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag()) ) ? true : false ;
    global $post;
    $posttype = get_post_type($post );
    return ( ((is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag())) && ( $posttype == 'post') ) ? true : false ;
    }


  2. wesbos revised this gist Sep 2, 2011. 1 changed file with 1 addition and 6 deletions.
    7 changes: 1 addition & 6 deletions is_blog.php
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,5 @@
    function is_blog () {
    if ( (is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag()) ) {
    return true;
    }
    else {
    return false;
    }
    return ( (is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag()) ) ? true : false ;
    }


  3. wesbos revised this gist Sep 2, 2011. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion is_blog.php
    Original file line number Diff line number Diff line change
    @@ -5,4 +5,9 @@ function is_blog () {
    else {
    return false;
    }
    }
    }


    Usage:

    <?php if (is_blog()) { echo 'You are on a blog page'; } ?>
  4. wesbos created this gist Sep 2, 2011.
    8 changes: 8 additions & 0 deletions is_blog.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    function is_blog () {
    if ( (is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag()) ) {
    return true;
    }
    else {
    return false;
    }
    }