[resolved] Number of comments - words instead of numbers? (5 posts)

  1. Dalton Rooney
    Posted 8 years ago #

    Hi there -
    I am using the following code in my template to display the number of comments per post (rather small number, unfortunately!):

    <?php comments_number('no comments','one comment','% comments'); ?>

    Does anyone know of a way that I could display the total number of comments as words instead of numbers? For example, I like the way it displays "one comment", but not as much "2 comments", I would much prefer "two comments".

    I know this is a relatively small issue, and I'm certainly not losing sleep over it, but I've always wondered about it and thought I would at least ask.


  2. MichaelH
    Posted 8 years ago #

    Can't do that in WordPress but here's a link to some PHP code that does:


  3. Dalton Rooney
    Posted 8 years ago #

    Ahhh, brilliant. Thank you.

  4. Dalton Rooney
    Posted 8 years ago #

    OK, I'm embarrassed to admit that I took a look at the code and can't make heads or tails of it. I understand what it does, basically, but have no idea how to put it in place of the WordPress code. Can anyone help, or is this the wrong forum for that sort of thing?

  5. Dalton Rooney
    Posted 8 years ago #

    Holy mackerel, I did it. Check it out at my photoblog @ seriouslyexcited.net.

    I basically used the code MichaelH found and combined that with the comments_number function into a small plugin and that did the trick. Thanks again.

Topic Closed

This topic has been closed to new replies.

About this Topic