Forums

Comments in reverse order (7 posts)

  1. minute44
    Member
    Posted 3 months ago #

    At the moment my comments all display most recent at the bottom...

    How do I reverse that?

  2. deuced
    Member
    Posted 3 months ago #

  3. trig338
    Member
    Posted 3 months ago #

    I've searched the sama answer for many hours.

    My theme (simplicity) has a comments.php with this line:

    $comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = '$id' AND comment_approved = '1' ORDER BY comment_date");`

    Can I add asc_order or something?

  4. deuced
    Member
    Posted 3 months ago #

    following this tip find comments.php in your theme and

    replace this:
    <?php foreach ($comments as $comment) : ?>

    with that:
    <?php foreach (array_reverse($comments) as $comment) : ?>

    then whatever order you have will be reversed.

  5. trig338
    Member
    Posted 3 months ago #

    Thanks! That fixed it. Next I will try to move the comments form as well:)

  6. U-recca
    Member
    Posted 2 months ago #

    where do you put this code??

    Thanks in advance

  7. peacearena
    Member
    Posted 1 month ago #

    Caveat: The comments will be in reverse order, but the last (top) comment will be numbered as "1.". One solution is to set the list-style-type to "none" so that there just aren't numbers at all. I'd prefer to show the highest number instead, but have no idea if this is possible, or how to do it if it is.

Reply

You must log in to post.

About this Topic