I have a div wrapper around my comments pagination. I have the comments set to paginate in the Wordpress admin at 10 comments per page. I want to hide the div wrapper if there are less than 10 comments (i.e. the pagination links aren't shown). I can't figure out how to do this. I know how to hide the div wrapper if pagination is turned off altogether, but I don't know how to check to see if the comments don't span to a second page when pagination is turned on. Here is my code:

<div class="comment-nav-wrapper">

    <div class="left-cap">&nbsp;</div>

    <div class="comment-nav">                   
        <?php paginate_comments_links($args); ?>

    <div class="right-cap">&nbsp;</div>


I would like to hide the comment-nav-wrapper altogether if the comments don't span to a second page. Is there some sort of Wordpress function for this, or do I need to come up with a bit of custom code?

1 Answer 1


Use the comments number function or the more native get_comments_number function and combine it with the page comments option if ( get_option( page_comments ) == TRUE ) // do stuff

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.