By CodeBru on
Hi,
I am trying to find a conditional statement or some other method to change the css based on what content type is shown. Does anyone know how to do this?
Hi,
I am trying to find a conditional statement or some other method to change the css based on what content type is shown. Does anyone know how to do this?
Comments
Try adding it in
Try adding it in hook_node_load(), checking the type of the node (the nodes are will come in the $nodes array).
Contact me to contract me for D7 -> D10/11 migrations.
Or anything really. I'm friendly, and open to work or conversation.
preprocess_node
preprocess_node
Nice! it work for me very well!!! until i saw the 404 page and the user page
don't use the preprocess_node function, some ideas?
404 and user pages do not use
404 and user pages do not use preprocess_node because they are ... not nodes :)
You're looking for template_preprocess_page.
no nodes
so i can use this conditionals in the preprocess of page instead of the node preprocess?
but how i know the type of "page" that they are?
Install the devel module and
Install the devel module and then
Flush the cache. You will now see variables you can use on the page. http://awesomescreenshot.com/0d0d3j59f
Let me know if this helps.
Nice but...
nice thank you, but i still have the problem that all the pages are of type pages, and i need to add
a especific css to the diferents types of content! but i feel i'm a litle closer to get it!
This will add a unique class
This will add a unique class to each page :
and this for node types :
then in template.php
thanks
i'm going to do it and see what happen!
thank's!!!
where to put the functions?
Where do I paste the functions?
thx