1

Is there any function that will show some content only if there are more than x comments ? For example show some banner only if more than 10 comments are in post ? Thanks :)

1 Answer 1

4

wp_count_comments() returns the number of comments either for the whole blog or just for the current post.

Example:

if ( 10 < wp_count_comments( get_the_ID() )->approved )
    echo 'Wow, more than 10 comments!';
0

Your Answer

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

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