1

I have 'blog posts' that are promoted to the front page. We would like to have the ability to have users posts comments on these posts through the front page without having to click through to get to the posts page.

1

The reason you do not see comment form on content promoted to front page is because by default comment form shows on full node view.So following code may help you.

function mymodulename_node_view($node, $view_mode, $langcode) {
  if(drupal_is_front_page() && $node->type == "your_content_type") {
      $node->content['comments'] = comment_node_page_additions($node);
  } 
}
13
  • appreciate it. where would I place this in the modules/comment/ file?
    – user21590
    Oct 6 '13 at 19:31
  • no not there we never hack the core,this is the reason we use hooks so you should use this in your custom module
    – arpitr
    Oct 6 '13 at 19:35
  • is creating a custom module the only way to accomplish this ? Have never done that before, after I create and name module, is this the only thing I would add to the code once created ?
    – user21590
    Oct 6 '13 at 19:52
  • well creating a custom module is quite simple and best way to go, I'll strongly recommend you to create custom module for this, otherwise you can do this at custom theme level also
    – arpitr
    Oct 6 '13 at 19:56
  • i have gone ahead and created my first module. It appears in the module list and I have enabled it. Am I missing something else?
    – user21590
    Oct 6 '13 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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