I have been trying to add the two most recent comments below each post on the main page.
When I do this it displays the most recent replies (first) which were for comments made earlier.
It has been quite frustrating and any help would be appreciated.
global $post, $wp_query;
$comment_args = array( 'orderby' => 'comment_count', 'post_id' => get_the_ID() );
$comment_array = get_comments($comment_args);
$count = 1;
?>
<?php if ($comment_array) { ?>
<span class="comments-link">•
<?php comments_popup_link(__('Be the first to comment!', 'encounters-lite'), __('1 Comment', 'encounters-lite'), __('% Comments', 'encounters-lite')); ?>
</span>
<span><?php _e( 'Discussion: ', 'encounters-lite' ); ?></span>
<span class="commentlist"></span>
<?php $comment_array = array_reverse($comment_array); ?>
<?php foreach($comment_array as $comment){ ?>
<?php if ($count++ <= 2) { ?>
This is a piece of the code I am working on.