WordPress.org

Support

Support » Themes and Templates » If has paginated comments

If has paginated comments

  • I have paginated comments activated on my blog. I also have it styled within a div. Problem is, if there isn’t enough comments to separate them into more than one page, I have an empty div.

    Is there some sort of ‘if has paginated comments’ function or workaround I can use that will only display the div if the post has enough comments to paginate?

    Here’s my code:

    <div id="paginate_comments"><?php paginate_comments_links(); ?></div>

Viewing 2 replies - 1 through 2 (of 2 total)
  • this is the related conditional code from twenty eleven’s comments.php:

    <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>

    Thank you so much. Worked like a charm! Final code for anyone that needs:

    <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?><div id="paginate_comments"><?php paginate_comments_links(); ?></div><?php endif; ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘If has paginated comments’ is closed to new replies.
Skip to toolbar