1

I would like to add different icon depends of comments number. For example post has 10 comments and it has standard icon. When post has more than 10 comments (it's hot topic) it has different icon. Any clue how to do that?

Edit:

I created div with custom icon picture (png) next to the comments number. As I said I would like to find a way to change that picture (by php function I guess) when the number of comments will be more than 20 for example.

1
  • Hi Radosław Jakubiak, could you provide more details on what you've tried already (and why it didn't work)?
    – kraftner
    Commented Jun 29, 2017 at 13:48

1 Answer 1

1

There is a ready function for doing such action:

Take a look here: https://codex.wordpress.org/Function_Reference/wp_count_comments

This should really sole your problem as you can use an if statement deciding the picture, just remember you have to use the post_id in order to get the count.

Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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