Please see the below code, I am able to see the block show up when a node has the taxonomy term listed (32715). What I am try to do is limit the block to only show up based on this term and not have multiple blocks appear when there is a match of more then one term. For example if the node has taxonomy for 32715, 32698, and 32715 three blocks will show on the page. I am trying to limit this to only show one block. Thanks!
<?php
if ( arg(0) == 'node' and is_numeric(arg(1)) and arg(2) == FALSE ) {
// Vocabulary term ID for which to display the block:
$displayTermID ="32715";
// Get all taxonomy terms for current node:
$currNodeTerms = taxonomy_node_get_terms(node_load(arg(1)));
// If there are no terms, fail-fast:
if (is_null($currNodeTerms) || 0 == count($currNodeTerms)) {
return FALSE;
}
// For each term of the current node, get all the ancestor terms:
foreach($currNodeTerms as $term) {
$ancestors = taxonomy_get_parents_all($term->tid);
// Check for each ancestor term whether it is the term we are looking for.
// If it is, return TRUE immediately:
if (!is_null($ancestors) && 0 < count($ancestors)) {
foreach($ancestors as $ancestor) {
if ($displayTermID == $ancestor->tid) {
return TRUE;
}
}
}
}
}