By wgd on
I am new to Drupal, please go easy on me if I am asking something stupid here.
I have installed D7 and it works fine. I have started creating a new theme using Stark as the base theme. I have been able to add some custom content fields for basic pages by using the Manage fields option under Manage content types. So far so good!
What I can't seem to be able to do is now target the content which is filled in when you create a node by CSS. The ideal solution for me would be to wrap the content in a unique class for each piece of content but I am unable to find anything online to tell me how to do this.
Any advice or links to tutorials would be highly appreciated.
Comments
firebug when you are on node
firebug when you are on node landing page you will find, unique css id for different nodes
Edit node.tpl.php in your theme
Add this code to your content div. It will have a unique id for ever node.
<div id="node-<?php print $node->nid; ?>" >Does stark have a node.tpl.php template?
I can't seem to locate the node.tpl.php file in my new theme. I duplicated Stark as the starting point for my new theme and it appears that it does not have this file? Is that right or am I looking in the wrong folder?
Copy it from garland theme
Copy it from garland theme and then paste in your theme, do changes you want, rebuild theme. it will reflect changes on node page.
Where do I add the code to create custom classes?
Forgive my ignorance here, PHP is not my forté. I have copied Garlands node.tpl.php file and have the following code
I need to add the code dhroople suggested
Would I do this by wrapping all the php in this file in another div with a class of content and then the PHP dhroople has suggested? or do I add it as a seperate block of code?
Actually you don't need to do
Actually you don't need to do anything, if you go content page ( in Drupal term node detail page) and firebug content you will see a unique id for your content. This will be different for each content.
however you want same thing in class you can do as follow
I am wonder why do you need different id/class for content.
I see it now, there is
I see it now, there is already a unique id for the content like you said. This is just what I need to target certain content with its own speciofic style.