WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Show Comment Number (4 posts)

  1. Buckycat7
    Member
    Posted 5 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?

  2. miloandrew
    Member
    Posted 5 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

  3. Buckycat7
    Member
    Posted 5 years ago #

    That worked. Thanks so much!

  4. danielb
    Member
    Posted 5 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.

Topic Closed

This topic has been closed to new replies.

About this Topic