Skip to content

Instantly share code, notes, and snippets.

@jaredatch
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaredatch/11118501 to your computer and use it in GitHub Desktop.
Save jaredatch/11118501 to your computer and use it in GitHub Desktop.
<?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