I simply need to display the "freshest" 3 topics from a specific forum in bbpress.
Is there a simple way to do this? Because I went nuts with trying to join tables. So here is my mysql solution (still cant code it well)....
So I instantly went into the database to check whats going on there, but I can't find a solution. sorting by post_modified didn't worked. So how can I get the FRESHEST topics under specific forum and display them?
Here is how the bbpress stores the data:
Forums -> Topics -> Reply on topics. Everything goes into wp_posts table.
Reply on Topics have a post_parent of Topics and Topics have post_parent of Forums. So definitely I cant use post_parent as a selection.
So I was thinking this (if someone can code this I would be grateful and even donate, because I am stuck somewhere).
Select all the posts from the table wp_posts that have post_type column which is 'reply'. Then check if the table wp_postmeta have a meta_value of 1263 (which is my parent forum) additionally it can be checked if meta_key from wp_postmeta is "_bbp_forum_id". This is how I will select all of the REPLYs.
After getting all of the replies under the FORUM I would like to check which 3 replies are freshest (getting the post_date value) and display their parent TOPICS. And I have to make sure that I dont have duplicates because the freshest 3 replies can be from the same TOPIC.
AM I COMPLICATING TOO MUCH ??? :)))
Any easier way?
THanks !!!