I create a new theme based on Bootsrap and the below template files, I limit show comment on every page on 50 comment in edit of content type in comment section, I have 126 comment in one of my node form that content type, but only see 50 comment and there is not any pager.

My question is that how can I add comment pager in below of comment?**


    <div id="comments" class="<?php print $classes; ?>"<?php print $attributes; ?>>
      <?php if ($content['comments'] && $node->type != 'forum'): ?>
        <?php print render($title_prefix); ?>
        <h2 class="title"><?php print t('Comments'); ?></h2>
        <?php print render($title_suffix); ?>
      <?php endif; ?>

      <?php print render($content['comments']); ?>
      <?php if ($content['comment_form']): ?>
        <h2 class="title comment-form"><?php print t('Add new comment'); ?></h2>
        <?php print render($content['comment_form']); ?>
      <?php endif; ?>

and comment.tpl.php

<div class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>

  <div class="attribution">

    <?php print $picture; ?>

    <div class="submitted">
      <p class="commenter-name">
        <?php print $author; ?>
      <p class="comment-time">
        <?php print $created; ?>
      <p class="comment-permalink">
        <?php print $permalink; ?>

  <div class="comment-text">
    <div class="comment-arrow"></div>

    <?php if ($new): ?>
      <span class="new"><?php print $new; ?></span>
    <?php endif; ?>

    <?php print render($title_prefix); ?>
    <h3<?php print $title_attributes; ?>><?php print $title; ?></h3>
    <?php print render($title_suffix); ?>

    <div class="content"<?php print $content_attributes; ?>>
        // We hide the comments and links now so that we can render them later.
        print render($content);
      <?php if ($signature): ?>
      <div class="user-signature clearfix">
        <?php print $signature; ?>
      <?php endif; ?>
    </div> <!-- /.content -->

    <?php print render($content['links']); ?>
  </div> <!-- /.comment-text -->

Any idea?

1 Answer 1


Adapted from this post on putting pagers above and below comments:

function mytemplate_comment_wrapper($content) {
  $comments_per_page = _comment_get_display_setting('comments_per_page');
  $content .= theme('pager', NULL, $comments_per_page, 0);
  return theme_comment_wrapper($content);

should render a pager for you if placed in comment-wrapper.tpl.php

  • I found this in my search but _comment_get_display_setting is for drupal 6 and 5
    – Yuseferi
    Commented Feb 17, 2015 at 5:27
  • function bartik_preprocess_comment_wrapper(&$vars){ $vars['content']['comments']['pager'] = array( '#theme' => 'pager', ); } Commented Feb 17, 2015 at 5:43
  • Oh right, sorry... a bit muddled today.
    – Darvanen
    Commented Feb 17, 2015 at 5:49

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.