Drupal 7: Zen theme, display comment count on node

2.3k views Asked by At

How do I display the number of comments near the title of the node when viewing the teaser? I want to make a little bubble next tot the title in the teaser displaying the number of comments.

1

There are 1 answers

0
m4rinos On

In Drupal 7 you can easily print out the number of comments by printing out the variable $comment_count. To print it out only for the teaser you can check the $view_mode variable before printing.

In your node.tpl.php (or if you have created a custom template for your content type such as node--[your-content-type-name].tpl.php, use that), just add something like the following at the position you want your comment count to show:

if ($view_mode=='teaser'):
   print $comment_count;
endif;

Don't know about your bubble, but if you mean a tooltip, I've always used qTip module for that http://drupal.org/project/qtip