0

I'm getting undefined offset with my code. I'm trying to pull out the top-level parent of a taxonomy of this archive page. Then set different menus depends on their top-level parent taxonomy

<?php
    global $post;
    $parent = get_post_ancestors( $post->ID );
    
  if ($parent[0] == 3) {
    bellows( 'main' , array( 'menu' => 25 ) );
  } elseif ($parent[0] == 2) {
    bellows( 'main' , array( 'menu' => 51 ) );
  }
?>

0 Answers0