Thread Starter
Jess
(@jessn)
Ah. So what I want to do is display the last page of comments fist by default. But I only want to do that for this particular page (I’m using a if is_page statement in the comments form). Anyone know if it’s possible to tell the comments to display the last page first in comments.php?
Thread Starter
Jess
(@jessn)
So nevermind, I went about it a different way. Perhaps this will help someone else in the future, who knows. I just queried the database to pull up posts for that particular page ID:
<?php
global $wpdb;
$sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID,
comment_post_ID, comment_author, comment_date_gmt, comment_approved,
comment_type,comment_author_url,
SUBSTRING(comment_content,1,50) AS com_excerpt
FROM $wpdb->comments
LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID =
$wpdb->posts.ID)
WHERE comment_approved = '1' AND comment_type = '' AND
post_password = '' AND comment_post_ID = 90
ORDER BY comment_date_gmt DESC LIMIT 13";
$comments = $wpdb->get_results($sql);
$comments = array_reverse($comments);
$output = $pre_HTML;
$output .= "\n
<ul class='sonnet-lines'>";
foreach ($comments as $comment) {
$output .= "\n
<li>"."
<div>" . strip_tags($comment->com_excerpt)
."</div>
</a></li>
";
}
$output .= "\n</ul>
";
$output .= $post_HTML;
echo $output; ?>