Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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 :)

share|improve this question

1 Answer 1

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!';
share|improve this answer
    
Thanks :) I will try this –  Chymmi Jan 10 '13 at 5:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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