[resolved] Customized comments pagination (2 posts)

  1. retroriff
    Posted 6 years ago #


    I've configured my WPMU 2.9 in order to paginate comments. It works when I use the comments.php template included on the default Kubrick theme. The function <?php wp_list_comments(); ?> displays paged comments correctly.

    I need to customize my comments without <?php wp_list_comments(); ?> and I don't get it work. The paged comments navigation code works:

    <?php if(get_comments_number() > get_option('comments_per_page')) : ?>
    <?php paginate_comments_links(); ?>
    <?php endif; ?>

    However comments.php is displaying all my comments on each paged comments page. I guess I must add some boundaries before <?php foreach ($comments as $comment) : ?>

    This is a summary of my code:

    <?php if ( have_comments() ) : ?>
        <?php foreach ($comments as $comment) : ?>
        <?php comment_text() ?>
        <?php endforeach; ?>
    <?php endif; ?>

    But it displays all comments instead of X per page. Does anyone know how to display the right comments amount?

    Thank you

  2. retroriff
    Posted 6 years ago #

    In order to customize comments it is better to use the 2.7 function:

    <?php wp_list_comments(); ?>

    And create a callback if you need to customize it. I've found here a good tutorial:


Topic Closed

This topic has been closed to new replies.

About this Topic