Buckycat7
Member
Posted 3 years ago #
I can't figure out a way to just show the comments number. Meaning I have a graphic in my design for comments and I only want the number of comments to show up in it.
I used this tag:
<?php comments_number('0'); ?>
It great if there are no comments, but once a comment is added is says # Comments. How can I get rid of the word comments and just show the number?
miloandrew
Member
Posted 3 years ago #
try:
<?php comment_number('%'); ?>
That should give you just the number... If it doesn't, try this:
<?php comment_number('0','1','%'); ?>
hope that helps!
-A
Buckycat7
Member
Posted 3 years ago #
That worked. Thanks so much!
danielb
Member
Posted 3 years ago #
Maybe this will be helpful to someone:
The better way is to use get_comments_number() function. It returns an integer with just number of comments for a given post, while comments_number() returns a NULL variable. It matters if you need to pass comments number to some custom PHP function.