The MU forums have moved to WordPress.org

Mostcommented posts. How to order by comment_count only? (1 post)

  1. mvkozyrev
    Member
    Posted 16 years ago #

    I try to use STREATCOWPMU to display mostcommented posts of the day. It works, but order posts list firstly by post time creation. Because first SELECT-function get last_updated blogs -

    '$blogs = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs WHERE
    last_updated >= DATE_SUB(CURRENT_DATE(), INTERVAL 10 DAY)

    AND public = '1'
    AND archived = '0'
    AND mature = '0'
    AND spam = '0'
    AND deleted = '0'
    ORDER BY last_updated DESC");'

    there is order by post time creation.

    So, when I try -

    'FROM $blogPostsTable WHERE
    post_status = 'publish'
    AND post_type = 'post'
    AND comment_count > '0'
    ORDER BY comment_count DESC");'

    - result is that, as list firstly ordered by time and then by comment count. Is it possible to rewrite code to order posts list by comment count only?

About this Topic

  • Started 16 years ago by mvkozyrev