1

I can't get the comment form to appear in my theme. It does appear in Garland, but not in Bartik.

I have copied node.tpl.php and comment.tpl.php into my theme from Garland.

I have added text to the node.tpl.php template to ensure that it is in fact the relevant template for the node.

I checked the page source to see if perhaps the comment form is appearing, but is hidden by CSS.

I deleted ALL code from the template.php file in the theme.

I have cleared the cache and run cron after doing all of the above.

I've built more than 100 Drupal sites, so I'm not exactly new to the framework. And yet I can't get the comment form to appear in this theme.

Clearly I must be doing something wrong, but I can't think of what else to check.

Any ideas?

Remember, the comment box does appear in Garland, so this can't be a permissions issue and can't be due to settings in the node itself.

The Drupal version is 7.41.

Thank you.

5
  • 1
    Within the top of your node.tpl.php, did you check the contents of $content['comments']? Feb 4, 2016 at 15:16
  • The contents of $content['comments'] is NULL if I var_dump it at the top of node.tpl.php. Meanwhile, I've discovered that the comments form does not appear in Bartik. It does appear in Garland. So I copied over the templates from Garland. However, the comments form still does not appear.
    – arnoldbird
    Feb 4, 2016 at 15:20
  • I edited the original post to indicate that the comments form does appear in Garland, but not in Bartik or in my custom theme.
    – arnoldbird
    Feb 4, 2016 at 15:31
  • remove all css and block all java scripts.
    – No Sssweat
    Feb 5, 2016 at 0:48
  • ^^This won't help as he already stated the comments section is not rendered. - As the $content['comments'] variable is empty, even switching the template files won't work. The next step he should do, is finding out why there are no comments within the node render information. Checking all node and comments preprocess functions of the installation might bring new insights. If there is no obvious override, I doubt he'll find a solution without debugging the code. (IMHO it must be a setting issue. Even arnoldbird insists on the settings are correct.) Feb 5, 2016 at 0:58

1 Answer 1

1

The "Comments block" module was the cause of this. The module appears to be functioning as intended. I just hadn't encountered this contributed module before, and didn't realize the project made use of it.

Because the "Comments block" module is installed, the "Comment form" block must be added to a region (e.g. "Content") in the theme. This explains why the comment form was appearing in some themes but not in others.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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