WordPress.org

Forums

If has paginated comments (3 posts)

  1. salromano
    Member
    Posted 3 years ago #

    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>

  2. 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 ?>
  3. salromano
    Member
    Posted 3 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags