WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to addd conditional pagination links on comments? (4 posts)

  1. retroriff
    Member
    Posted 4 years ago #

    Hello,

    I am using paginate_comments_links() in order to paginate my comments on WP 2.9. However I'd like to display some code only when the entry has more than 1 comments page. For example:

    <ul>
    	<li>More comments:</li>
    	<li><?php paginate_comments_links(); ?></li>
    </ul>

    Any idea?
    Thank you

  2. kz
    Member
    Posted 4 years ago #

    <?php if(get_comments_number() > 10/* comments per page */) : ?>
    <ul>
      <li>More comments:</li>
      <li><?php paginate_comments_links(); ?></li>
    </ul>
    <?php endif; ?>
  3. kz
    Member
    Posted 4 years ago #

    Better code:

    <?php if(get_comments_number() > get_option('comments_per_page')) : ?>
    <ul>
      <li>More comments:</li>
      <li><?php paginate_comments_links(); ?></li>
    </ul>
    <?php endif; ?>
  4. retroriff
    Member
    Posted 4 years ago #

    Thanks kz, it works perfectly :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags