How can the title/subject not be displayed in a published comment.

I have already disabled the subject/title field for entering comments, meaning that users only have a comment body box for which to enter text. (I used the following question and answer to achieve that: Remove subject field from comments )

However, even with this disabled, the initial few words of the comment body get displayed automatically as the subject/title.

Background: I'm developing a stackexchange question/answer style system for my site and am looking for a similar kind of layout.

P.S. I'd be happy with a code-based solution (in a module, or theme) to override a hook (I'm examining the mark-up for clues myself) Or a module would be fine.

1 Answer 1


In your theme folder, if you do not have a comment.tpl.php file, create one. And customize yours to not have the title. Just take out the title from the file

Another option is to try removing it in your template.php file in the yourtheme_preprocess_comment() function

  • Thanks, that's the kind of approach I'm looking for. Additionally I'd also be looking to pinpoint hook functions so that I can include them in my own module so that this functionality prevails across any theme. Maybe (but much later perhaps) even contrib the module to drupal.org if I can develop a config UI. Jul 4, 2013 at 9:12
  • you could try removing it in your template.php file in the yourtheme_preprocess_comment() function
    – 4life
    Jul 4, 2013 at 9:26
  • +1 accepted. I copied the comment.tpl.php file and placed it in my own theme and removed title markup: <?php print render($title_prefix); ?> <h3<?php print $title_attributes; ?>><?php print $title ?></h3> <?php print render($title_suffix); ?> this template already gives the opportunity to re-arrange other fields. Thanks. Later I'd like to move this to my own custom module so that this is not theme dependent. I believe this is also possible but requires knowledge of the theme registry. Jul 4, 2013 at 10:41

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.