[wp-hackers] Order posts by time of their last comment
aaron at jorb.in
Mon Sep 27 19:29:08 UTC 2010
On 9/27/10, Christian Foster <christian.foster at gmail.com> wrote:
> I have a requirement to list posts by the time of their last comment.
> I am trying to keep it simple, the current page which lists by other
> factors like post type uses a slightly modified pagination function
> with a pre_get_posts filter to set the required query parameters, we
> have tens of thousands of posts of different types so the pagination
> is very important.
> Can anyone think of a good way to sort a large number of posts by the
> date of their last comment? Is it then possible to use the same
> pagination function and posts_per_page/paged query variables?
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
I would add a post_meta field for the date/time of most recent comment
and hook into comment_post and wp_set_comment_status to update it. You
can then order by the meta value.
More information about the wp-hackers