Invert a inverted WP comment query?
-
Hi!
I use the following code to get the latest 2 comments per post on my frontpage:
<?php $comment_array = array_reverse(get_approved_comments($wp_query->post->ID)); $count = 1; ?> <?php if ($comment_array) { ?> <ul class="commentlist"> <?php foreach($comment_array as $comment){ ?> <?php if ($count++ <= 2) { ?> <li <?php echo $oddcomment; ?>id="comment-<?php comment_ID() ?>"> <div class="vcard"><?php echo get_avatar( $comment, 48 ); ?></div> <?php if ($comment->comment_approved == '0') : ?> <p class="red bold">Your comment is awaiting moderation.</p> <?php endif; ?> <?php comment_text() ?>
The problem is that i have to sort it, currently the latest comments ends up at the top and the second newest at the bottom, i want it to be the other way around!
How do i do that? Appreciate any comments!
- The topic ‘Invert a inverted WP comment query?’ is closed to new replies.