By narcisgirona on
Hi guys,
I have a little addvertisment site where i would to difference the ads: for sale and to buy. To do that i wanna change the background color of the ads depending on whihc type they are. Lets say orange for: to sale, and green for: to buy/interested on buying. When the user posts the ad it chooses from a drop down menu (taxonomy) which type this is. So i would like the css to change the background color, depending on the user choice of this taxonomy term.
I tried to do that with css but can´t figure out how to tell css if taxonomy term = sell then background view orange, if taxonomy = buy then background view green..
Thanks in advance for your help!
Comments
_
You'll need to add the term as a css class-- likely the node div or some other tag so you can target it in your theme. If the ads are in fact nodes, you can do it with a preprocess_node function in the template.php file for your theme. For a good example of how it's done, see the adaptivetheme's core template.php file.
Actually i already thought on
Actually i already thought on adding the term as a css class but how i do it if this term has 2 elements like:
term: type
- sell
- buy
how i should i add the 'buy type' i should use somekinf of conditional on the css but not sure is this is possible.
Thanks for your help WorldFallz!
_
I would just use the term itself as the class: