How to create a custom theme for a page? I want to create a template for my example/123 page.

  • Context Layouts... – Alex Gill Mar 28 '14 at 11:30

To create a custom template for node/123, copy your theme's default page.tpl.php to a file named page--node--123.tpl.php (D7) in your theme's or subtheme's templates/ directory, and then edit it to do any customization.

To do custom theming, add custom classes where you need them in the custom template, and then add the CSS to style those classes.

Btw.: I usually do this by creating a sub-theme, to avoid any customization from being overwritten when the super-theme is upgraded.

PS: If your page really has the path example/123, the name of the template overide file should be page--example--123.tpl.php

Remember to clear the cache after doing this. Until you do, your override will not be visible.

| improve this answer | |
  • Need To describe any thing in template.php ? – Hissam Khan Babar Mar 28 '14 at 14:02
  • There is usually no need to change template.php unless you're changing more than just appearance. Drupal will pick up the override based upon its name alone. – Free Radical Mar 28 '14 at 14:55
  • But This is not page type. then any changes need? – Hissam Khan Babar Mar 28 '14 at 16:59
  • If it is not a page type, then overriding the page template won't work. Please edit your question and explain in detail what you mean by "example/123 page". – Free Radical Mar 28 '14 at 17:05
  • its my call back menu item. from which i loading a drupal form . and i want to themes this thanks – Hissam Khan Babar Mar 28 '14 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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