I am not a dev, but am trying to show and hide a div for on a particular node type node.tpl.php file based on taxonomy term value.
can someone please let me know how to do this.
*I AM ADDING THE ANSWER HERE AS I AM NOT ELIGIBLE FOR ANSWERING *
I have a div which prints the taxonomy value of a node (where 30 is the vacabulary ID):
<div class="node-r-status-tid-0 <?php print $term_css;?>">
<?php print THEME_NAME_taxonomy_list($node, 30); ?>
</div>
Below is the PHP code to make the dive show and hide:
<?php
if ($node->taxonomy[868])
$tid = 868; // This should be the taxonomy term id that you want to theme on
foreach ( (array)$node->taxonomy as $term ) {
if ( $term->tid == $tid ) {
$term_css = " node-r-status-tid-" . $term->tid;
break;
}
}
if($node->taxonomy[869])
$tid = 869; // This should be the taxonomy term id that you want to theme on
foreach ( (array)$node->taxonomy as $term ) {
if ( $term->tid == $tid ) {
$term_css = " node-r-status-tid-" . $term->tid;
break;
}
}
?>
Using css classes I make the dive display:block or none.
Please let me know if the above code can be fine tuned further
Thanks, Anand