I have been losing quite a lot of time with something that seemed straightforward initially.

I am trying to use a template file(tpl.php) to print a content type with custom html layout.

In template.php I added.

function responsive_bartik_preprocess_node(&$variables) {
  if ($variables['type'] == 'dagens_billet') {
    $variables['theme_hook_suggestions'][] = 'templates/dagens_billet--template';

I added a templates/dagens_billet--template.tpl.php but nothing is being printed. I've added the following test code in there:

<?php print render('Giannisssssssssssssss'); ?>

Any suggestions to make it work?

2 Answers 2


this is my method for doing such thing and it always works.

create a view of your content type (ct), say ct__view. create a page and rename it to
page--path_of_view.tpl.php and embed that view inside it at any where you want with this instruction <?php print views_embed_view('ct__view','page');?>. now you can customize its fields output with views-view-fields--ct__view--page.tpl.php

  • Where do you place all these files? Commented Oct 6, 2013 at 10:01
  • at your theme folder for me on localhost is C:\xampp\htdocs\MY_THEME_NAME\sites\all\themes\MY_THEME_NAME
    – user21400
    Commented Oct 6, 2013 at 15:02

The solution I found is quite simple. Just creating a sites/all/themes/{mytheme}/templates/node-{content_type_machine_name}.tpl.php

This is explained nicely at http://www.slideshare.net/aimeemaree/a-look-at-drupal-7-theming

  • this method node--ct.tpl.php does not work on drupal 7 any more.
    – M a m a D
    Commented Oct 6, 2013 at 15:10

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.