-
-
Save jjeaton/5808697 to your computer and use it in GitHub Desktop.
Revisions
-
jjeaton revised this gist
Jun 18, 2013 . 1 changed file with 22 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,25 @@ /** * WordPress' missing is_blog() function. Determines if the currently viewed page is * one of the blog pages, including the blog home page, archive, category/tag, author, or single * post pages. * * Doesn't include is_search(), if you only use search for the blog, then add that in or test separately * * @props grantnorwood * @return bool */ function is_blog() { global $post; //Post type must be 'post'. $post_type = get_post_type( $post ); //Check all blog-related conditional tags, as well as the current post type, //to determine if we're viewing a blog page. return ( ( is_home() || is_archive() || is_single() ) && ($post_type == 'post') ); } -
wesbos revised this gist
Sep 6, 2011 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,7 @@ 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 ; } -
wesbos revised this gist
Sep 2, 2011 . 1 changed file with 1 addition and 6 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,5 @@ function is_blog () { return ( (is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag()) ) ? true : false ; } -
wesbos revised this gist
Sep 2, 2011 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal 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'; } ?> -
wesbos created this gist
Sep 2, 2011 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal 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; } }