Support » Fixing WordPress » Show Comment Number

  • Resolved Erik


    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?

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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!

    That worked. Thanks so much!

    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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show Comment Number’ is closed to new replies.