Looking for a way to list new entries, from multiple channels, and existing entries that have received comments - in the last n days. I'd be really grateful for any leads on how to do this!

Best wishes Lee

1 Answer 1


ExpressionEngine does have an easy way to display recent comments, but it sounds like that's not quite what you're looking for. You need a list of distinct entries having at least one comment in the last N days.

One way to accomplish this is with the Query module:

{exp:query sql=
    "SELECT title
    FROM exp_channel_titles
    JOIN exp_comments
    ON exp_comments.entry_id = exp_channel_titles.entry_id
    WHERE FROM_UNIXTIME(comment_date, '%Y-%m-%d') > DATE_SUB(CURDATE(), INTERVAL 10 DAY)
    GROUP BY exp_channel_titles.entry_id"

This will give a list of entries with comments in the last 10 days.

The key pieces are the last two lines of the query where we compare the comment date against a time interval based on the current date, and then group by entry to prevent duplicates due to multiple qualifying comments on the same entry.

  • Thank you VERY much Alex - very kind of you to take the time to write that for me. It's exactly what I was after and I've learnt something new as well. Commented Feb 8, 2013 at 9:13
  • Glad I could help. I learned something, too!
    – Alex Kendrick
    Commented Feb 8, 2013 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.