Posted By

howardpanton on 10/30/10


Tagged

wordpress


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

booski
kwameboame


Wordpress Comment count


 / Published in: PHP
 

Count commetns and return value into the post

  1. <h1><?php
  2. $commentscount = get_comments_number();
  3. if($commentscount == 1): $commenttext = 'comment'; endif;
  4. if($commentscount > 1 || $commentscount == 0): $commenttext = 'comments'; endif;
  5. echo get_the_title().' ('.$commentscount.' '.$commenttext.')';
  6. ?></h1>

Report this snippet  

You need to login to post a comment.