I'm trying to display the comments on a node at the top of the page. I've edited node.tpl.php in my theme to be:

<article id="article-<?php print $node->nid; ?>" class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>

  <?php print $unpublished; ?>
  <?php print render($content['comments']); ?>
  <?php print render($title_prefix); ?>
  <?php if(!empty($user_picture) || $title || (!empty($submitted) && $display_submitted)): ?>
    <header class="clearfix<?php $user_picture ? print ' with-picture' : ''; ?>">

      <?php print $user_picture; ?>

      <?php if ($title): ?>
        <h1<?php print $title_attributes; ?>>
          <?php if ($page): ?>
            <?php print $title; ?>
          <?php elseif (!$page): ?>
            <a href="<?php print $node_url; ?>" rel="bookmark"><?php print $title; ?></a>
          <?php endif; ?>
      <?php endif; ?>

      <?php if ($display_submitted): ?>
        <div class="submitted">
            //By:   Mike Ghen 
            //Date: 5/21/2012
            //Description: This Modifies the submitted user and date info.
            //             Code from: http://drupal.org/node/1072640
            if ($submitted) { 
                echo "Submitted on " . date( "F j, Y",$node->created);  
      <?php endif; ?>

  <?php endif; ?>
  <?php print render($title_suffix); ?>

  <div<?php print $content_attributes; ?>>
    print render($content);

  <?php if ($links = render($content['links'])): ?>
  <?php endif; ?>


I moved <?php print render($content['comments']); ?> to the top of the page but, it makes the form to fill out a comment appear at the top of the page as well. Is there a way to render the comments at the top and the comment form at the bottom?


you attack this line in file :

    // Remove the "Add new comment" link on the teaser page or if the comment
    // form is being displayed on the same page.
    if ($teaser || !empty($content['comments']['comment_form'])) {
    // Only display the wrapper div if there are links.
    $links = render($content['links']);
    if ($links):
    <div class="link-wrapper">
      print $links; 
  <?php endif; ?>

You are editing a node template , in this situation you are not able to change an element itself , but you can go to comments module , there you can find a template file inside which generates the comment output , copy it to your theme folder/templates then modify it there and changes will be applied. An easier solution could gain by using Panels and page manager . it will take you just some mouse clicks.

protected by Community Jul 13 '15 at 3:31

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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