WordPress.org

Support

Support » Themes and Templates » [Resolved] chanching the way comment are listed

[Resolved] chanching the way comment are listed

  • I’d like to change the order of the comments, not like this
    1.
    2.
    3.
    etc.

    but the newer post on the top! like this
    3.
    2.
    1.

    in what php file do i have to change something and what do I have to change??

    Matje

Viewing 3 replies - 1 through 3 (of 3 total)
  • Mark (podz)
    Support Maven

    @podz

    Descending Comments
    File: /wp-includes/comment-functions.php

    Line 13
    if ( empty($comment_author) ) {
    $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post->ID' AND comment_approved = '1' ORDER BY comment_date DESC");

    See the DESC at the end ? Add that.

    Line 18
    $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post->ID' AND ( comment_approved = '1' OR ( comment_author = '$author_db' AND comment_author_email = '$email_db' AND comment_approved = '0' ) ) ORDER BY comment_date DESC");
    See the DESC at the end of this line ? Add that too.

    That’s it.

    This is a core change, so remember it.
    (Above applies to wp2.x)

    http://wordpress.org/support/topic/38145?replies=10#post-331645

    might help for the comments number too 🙂

    // Do not have to worry about the core file when upgrading too because the change is in the themes file..

    yeah mean, it works!!! super work.
    thank you very much podz
    Matje

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] chanching the way comment are listed’ is closed to new replies.