1

How do I modify the layout or look-and-feel of a specific node, for example the one whose ID is 230?

Which template file should I create to only change the output for a single node?

I had done it before in Drupal 6. I don't know how to achieve it in Drupal 7.

1
  • node--230.tpl.php
    – No Sssweat
    Oct 27, 2016 at 8:10

2 Answers 2

2

In Drupal 6 the template file should be like node-<nodeid>.tpl.php

In Drupal 7 the template file should be like node--<nodeid>.tpl.php

Difference between these two is double hypen.

2

One of the things you can do to help with this is to enable Theme Debug mode, see here:

https://www.drupal.org/node/223440#theme-debug

This will tell you what templates are currently being used, and will provide suggestions for what templates to use, when you inspect the source of your node page (the suggestions are in HTML comments, so make sure they're enabled in your inspector).

It also details how to create your own custom template suggestions, the patterns of which is detailed here:

https://www.drupal.org/node/1089656

Make sure you place the templates inside your theme directory in order for the theme to pick them up.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.