Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $cats = array();
- foreach ($categories as $category) {
- $cats[] = $category->term_id;
- }
- //print_r($cats);
- function func($val, $cat, $n, $max) {
- if ($n>=$max) {
- return true;
- }
- return ($val != $cat[$n]) && func($val, $cat, $n+1, $max);
- }
- if($object->parent > 0 && func($object->parent, $cat, 0, 3)) {
- $bcn_use_term = $key;
- //We found our first term hiearchy, can exit loop now
- break;
- }
Add Comment
Please, Sign In to add comment