In this post I show you the code to show the total number of comments in WordPress that visitor comments on your post without use any plugin. I think showing the number of comments on every post it make the visitor more interesting on the post that have a lots of comments.
Let add the code below to your theme’s funtion.php:
[php]
function sopheap_comment_count() {
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo ‘<span class="comments-link">’;
comments_popup_link( __( ‘Leave a comment’, ‘sopheap’ ), __( ‘One comment so far’, ‘sopheap’ ), __( ‘% Comments’, ‘sopheap’ ) );
echo ‘</span>’;
}
}
[/php]
Add the function to your theme’s index.php. You can show on the top or bottom up to you.
[php]
<?php sopheap_comment_count(); ?>
[/php]
Comments