/ Published in: PHP

Count commetns and return value into the post
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<h1><?php $commentscount = get_comments_number(); if($commentscount == 1): $commenttext = 'comment'; endif; if($commentscount > 1 || $commentscount == 0): $commenttext = 'comments'; endif; echo get_the_title().' ('.$commentscount.' '.$commenttext.')'; ?></h1>
Comments
