I need to display comments starting from the second, omitting the first.
With posts I did it using “offset” but I can’t find anything similar for comments.
Since I’m using threaded comments, must start from the second comment that is not a child (only parent comments).
I’m using wp_list_comments with a callback.
EDIT2: this is actual comments.php code, after replies:
<?php
$i = 2;
if ( have_comments() ) :
if ( $i > 1 ) :
?>
<div id="comments">
<h3 id="comments-title" class="color-<?php $category = get_the_category(); echo $category[0]->cat_name;?>">
</h3>
<?php
global $wp_query;
$comments_arr = $wp_query->comments;
$comments_arr = sort( $comments_arr);
$comments_arr = array_pop( $comments_arr );
$comments_arr = usort($comment_arr, 'comment_comparator');
wp_list_comments('callback=gtcn_basic_callback', $comments_arr);
?>
<?php
$i++; // count up
endif; // If $i > 1
else : if ( ! comments_open() ) : ?>
<p><?php _e( 'Comments are closed.' ); ?></p>
<?php
endif; // end ! comments_open()
endif; // end have_comments() ?>
</div>
<?php comment_form(); ?>
Result: comments are not anymore ordered by karma (comment_comparator function) and the first comment (comment with top karma that I want to hide) is still displayed.
Ad your current loop:
No need for
$counter = 2;
(called nowhere).If you already got your
$comments_arr
, why not simply:OR