in ,

Display The Total Number Of Comments In WordPress

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]

What do you think?

Written by Sopheap

The goal of me is sharing new ideas, inspiration art, fresh and useful resource, covering web design and development, graphic design, advertising, mobile development and life style.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Create Slide Show In WordPress

Create Slide Show In WordPress

illustrator Design Flat Cup Of Coffee ~ Sopheap

illustrator Design Flat Cup Of Coffee