Created
January 23, 2014 12:02
-
-
Save davemac/8577491 to your computer and use it in GitHub Desktop.
WordPress check if category is a parent
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 characters
| // check if category is a parent | |
| function dmc_is_parentcat() { | |
| $cat = get_query_var('cat'); | |
| $category = get_category($cat); | |
| $category->parent; | |
| return ( $category->parent == '0' ) ? true : false; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment