If I wanted to add a CSS-styled box around the content (each teaser that gets promoted) on my front page, how would I do that? I don't want the box to appear anywhere else, just there. I think it would look nice and separate the individual teasers that are promoted there. If you look at the comments on any of my topics, I have already done this very thing there.
Can you tell me where I add my CSS for this?
For reference, if you visit http://www.hordearmy.com/node, the two gray boxes at the top are what I am talking about. I would not want to have the background be gray for this, just the simple gray border that appears around the two items at the top of that page would appear around the individual teasers on the front page.
Thanks!
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | node-border.png | 76.38 KB | jwolf |
Comments
Comment #1
jwolf commentedFirst off you'll need to put the following into the theme's template.php file:
The above allows you to create different node templates by node variables (nid, type, view). In other words, this allows you to create a separate layout for the page view and the node teaser(s).
Next, create a new file called node-story-page.tpl.php ("story" if you are using the "story" content type) and copy your existing node.tpl.php's contents into node-story-page.tpl.php
Then create a new file called node-story.tpl.php and place into that file the following :
In the style.css file, for the theme, add the .nodeTeaser class as follows:
Now, node-story.tpl.php will control the look for the teasers and node-story-page.tpl.php will control the look for the page.
If you're using a custom content type (other than "story") then change node-story & node-story-page to node-name_of_your_content_type.tpl.php and node-name_of_your_content_type-page.tpl.php
See screenshot for the end result.
Or.. you can just do an ifelse conditional statement (based on page !=0) in node.tpl.php and forget everything mentioned above. :)
Comment #2
jwolf commentedComment #3
nathanashton commentedI've tried this and it is working for me well.
The only thing is, all of Headings on the front page have lost their formatting. They used to be in bold and large fonts, now they are normal hyperlinks.
I'm guessing something above changed the .css.
Any ideas?