Last active
August 29, 2015 14:00
-
-
Save jaredatch/11118501 to your computer and use it in GitHub Desktop.
This file contains 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 characters
<?php | |
/** | |
* Check for parent and sub categories | |
* | |
* @param int $id | |
* @return bool | |
*/ | |
function ja_is_category_deep( $id = '' ) { | |
if ( !is_category() || empty( $id ) ) | |
return false; | |
$category = get_category( get_query_var('cat') ); | |
if ( $category->term_id == $id || $category->parent == $id ) { | |
return true; | |
} else { | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment