problem with comment sorting using wp_list_comments( );

I have problem with comments sorting and display.

I display comments in the loop,
I allow to nest comments to max depth =2.
The settings and function for formatting and display are below.
So i display 100 newest comments in the wat that newest is at the top.

However this only works for parent comment. If children are added the date of them is not taken into account, only parent comment date. In this way nested comments are display somewhere in the middle and barely visible.

How to modify the code to sort and display the comments that way the family (parent + children) date is taken into account, and the newest family is at the top?

How to modify the code to add pagination?

<?php if ( have_comments() ) : ?>
<?php $args = array(
‘walker’ => null,
‘max_depth’ => ‘2’,
‘style’ => ‘ul’,
‘callback’ => ‘user_format_comment’,
‘end-callback’ => null,
‘type’ => ‘all’,
‘reply_text’ => ”,
‘login_text’ => ”,
‘page’ => ”,
‘per_page’ => 100, // 100 only 100 newest comments
‘avatar_size’ => 32,
‘reverse_top_level’ => ‘true’, //new TOP level first
‘reverse_children’ => ”,
‘format’ => ‘html5’,
‘short_ping’ => false, // @since 3.6
‘echo’ => true // boolean, default is true
);
wp_list_comments( $args, $comments );

comment_form($comments_args); ?>
<?php endif; ?>

Read more here:: problem with comment sorting using wp_list_comments( );

Leave a Reply

Your email address will not be published. Required fields are marked *