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.

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> 

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

</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?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

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

share|improve this answer
add comment

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.