0

I have the below code which will show comment count:

<?php echo comments_number();?>

It generates output like 0 Comment, 1 Comment, 2 Comments and so on.

I just want it to show 0,1,2 etc. So I have replaced the above code to:

<?php echo comments_number(0, 1 );?>

It now works fine for 0 comments and 1 Comment replacing them as 0 and 1. But If I add the Third Value as %s or %d there in the above code to show 2 comments as 2, it is showing an error that % is not valid.

What I am missing here?

0

There's is also the get_comments_number() to get only the number of comments for the post.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.