Ordering posts by most recently commented
-
What’s the query to list wordpress posts by most recent, with posts that are commented on going to the top of the order? This is standard “message board” style.
I tried this:
select wp_posts.*, coalesce( ( select max(comment_date) from $wpdb->comments wpc where wpc.comment_post_id = wp_posts.id ), wp_posts.post_date ) as mcomment_date from $wpdb->posts wp_posts order by mcomment_date desc limit 10
But that’s not right.
Can anyone help?
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Ordering posts by most recently commented’ is closed to new replies.