[wp-trac] [WordPress Trac] #4297: Order Comments
WordPress Trac
wp-trac at lists.automattic.com
Sat May 19 09:15:40 GMT 2007
#4297: Order Comments
---------------------+------------------------------------------------------
Reporter: hyp0r | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 2.4
Component: General | Version:
Severity: minor | Keywords:
---------------------+------------------------------------------------------
Allow comments to by sorted in descending order.
On some pages on my site I like to list comments with the newest comment
on top. Every time that I upgrade I have to make these changes to the
comment-template.php
line 280:
add ''', $order = 'ASC' ''' to the comments_template function:
{{{
function comments_template( $file = '/comments.php', $order = 'ASC' ) {
}}}
line 292, 294 & 298:
add ''' $order''' after ORDER BY comment_date
{{{
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE
comment_post_ID = '$post->ID' AND (comment_approved = '1' OR ( user_id =
'$user_ID' AND comment_approved = '0' ) ) ORDER BY comment_date $order");
}}}
With the above modifications the code will continue to work exactly the
way it does now. But you can use this code:
{{{
<?php comments_template('/comments.php','DESC'); ?>
}}}
and it will display the comments in descending order.
----
I don't see any reason that this would cause any problems. I'd love to
help add this feature (it's quite simple). I'm not sure how to do that, if
someone could point me in the right direction I'd love to help out.
--
Ticket URL: <http://trac.wordpress.org/ticket/4297>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list