Created
April 25, 2013 06:06
-
-
Save spencejs/5457826 to your computer and use it in GitHub Desktop.
Deepest Level Category
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
//Deepest Level Category | |
function get_deep_child_category( $categories ) | |
{ | |
$maxId = 0; | |
$maxKey = 0; | |
foreach ( $categories as $key => $value ) | |
{ | |
if ( $value->parent > $maxId ) | |
{ | |
$maxId = $value->term_id; | |
$maxKey = $key; | |
} | |
} | |
return $categories[$maxKey]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment