How do I add a custom style to node by its type?


If the content type of the node is Article, then the template file Drupal looks for is node--article.tpl.php.
If the content type name contains underscores, those are replaced with hyphens. If the content type machine name is snippet_code, then the template filename is node--snippet-code.tpl.php.

Tags: Theming

Similar questions

writing views style plugin -error - Display "Master" has an invalid style plugin
I'm writing a views display plguin, I defined it as follows in I created class and theme functions. When I select 'mymodule Articles Listing' while created view I get error Display "Master" has an invalid style plugin. Display "Page" has an invalid style plugin. Upate 1 While running in devel execute php does not return any thing...
Render with custom style all contents of a content-type from custom module
I am trying to create a custom module to manage a slider. After install my current-development module, I have: EDIT: Code updated You can check the module code here: I wonder how could I add a wrapper that contains all nodes of this content-type and call to render each node using the template defined. The idea I ...
Custom content type with a gallery and its "subgalleries" (or categorized gallery) in D7
I have a content type with some custom fields, and I would like to have a gallery in it, with the images grouped into predefined "categories" - like a "subgallery". For example, I have a "building" content type, and I would like to categorize the photos of it depending on of which part of the building (house) these photos were made or if they are s...
Custom content type with field that creates its own CSS?
I'm looking to create a content type which includes a field for an image file - simple enough. However, I want this image file to be displayed as a background-image. Do I have to create a custom node.tpl and include the image source in an inline style="background: url(sites/all/themes/theme/images/image.png);", or is there a more elegant way to do ...
Limit which roles can view a node basing on its content type
I'm using Drupal 7 and I created a new content type called "eBook," and I created a new role called "MonthlySubscriber." My intention is to allow only users with the "MonthlySubscriber" to view the "eBook" nodes. When I looked at the permission settings for a role, I saw the checkboxes that allows to create, edit and delete nodes of that content ty...
How can I change a field's widget type on its node edit page?
I have a node type that uses Fuploader image field widget. When a user creates new a node of this type, I want them to be able to use the fuploader widget to upload images. When the user edits that node at some point, I want to switch to the normal imagefield widget. How can I accomplish this?

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.