开发者

Drupal 7 comment.tpl.php overwrite for specific node type is not working

I've created a comment--track.tpl.php file in order to theme the comments of my "track" type node but I can't get Drupal to use it. It keeps using my themename/comment.tpl.php file. I made sure to clear cache, I also set the Devel module to rebuilt the theme registry on each load, but it just doesn't want to use my custom theme file. A开发者_如何学Cnyone has any ideas?


For Drupal 7 create a new file in your theme folder "comment--node-[type].tpl.php". In your case file name should be "comment--node-track.tpl.php"


The corresponding template suggestions seems to be missing in D7. See: D7 vs. D6. Not sure why and if that is a bug, but you can implement yourtheme_preprocess_comment() and add the following line yourself.

<?php
$variables['template_files'][] = 'comment-' . $variables['node']->type;
?>


For Drupal 7:

comment--node-YOURNAMECONTENTTYPE.tpl.php

If you want to override your comment.tpl.php in content type what has name article, you need to:

  1. Copy original file-template comment.tpl.php from core Drupal 7
  2. Paste it in your theme folder
  3. Make a duplicate
  4. Rename the duplicate to comment--node-article.tpl.php
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜