Guest User

Untitled

a guest
Apr 20th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. $cats = array();
  2. foreach ($categories as $category) {
  3. $cats[] = $category->term_id;
  4. }
  5. //print_r($cats);
  6.  
  7. function func($val, $cat, $n, $max) {
  8. if ($n>=$max) {
  9. return true;
  10. }
  11. return ($val != $cat[$n]) && func($val, $cat, $n+1, $max);
  12. }
  13.  
  14. if($object->parent > 0 && func($object->parent, $cat, 0, 3)) {
  15. $bcn_use_term = $key;
  16. //We found our first term hiearchy, can exit loop now
  17. break;
  18. }
Add Comment
Please, Sign In to add comment