By br4t on
Hi
Based on this snippet of code
<? php if (is_array( $node->taxonomy ) ) {
foreach ( $node->taxonomy as $item ) {
if ($item->tid == 1) {
print " screencast";
} else if ( $item->tid == 2 ) {
print " screencast2";
} else {
print " default";
}
}
}
?>
it should be possible to change the class of the node.
I want to apply this to my sidebar, and unfortunately this piece of code seems to do nothing but sit.
Is anyone aware of a way to check what taxonomy term is used in the node content and use that to apply a certain css class to the sidebar?
Comments
Which works just perfectly
Which works just perfectly if you know how to apply it correctly.
What i have been doing wrong was applying it to my block.tpl.php (thinking that i wanted to apply my style to a block, so code goes into block).
However when applied to page.tpl.php (and more specifically after the
statement it appears to work perfect.
Using css to do the .block styling from here on.