Thursday, October 15, 2015

Creating content type tpl file in drupal 7

In Drupal 7, Page.tpl.php will be the default template file for whole site. In top of this, we can customize our template for different content type, individual nodes and front pages. Even we can customize the block template and views templates.

In this blog post, i am going to give you small snippet of code for creating template file depends on content type.

To create a template file for content type, First step we need to define in template.php file on hook_preprocess_page method.


After included in template.php we need to copy the page.tpl.php. Paste in same folder, rename it according to you content type.

For example:- My content type name is reviews. My file name should be page--reviews.tpl.php

In this file, you can customize your design.

No comments:

Post a Comment