Display list of topics under specific forum
-
Hi guys I am trying to list the 3 freshest bbpress topics from a specific forum. How Can I do that?
This is my code for displaying latest 3 topics from bbpress (not specific forum):
`get_results(“SELECT post_title, guid, post_date, post_type, post_modified, post_type from wp_posts where post_type LIKE ‘topic’ && post_type LIKE ‘topic’ ORDER by post_date DESC limit 3″,”ARRAY_N”);
if ($forumslist)
{
foreach ($forumslist as $row)
{
echo ‘- ‘.$row[0].’‘.date(‘F d, Y’, strtotime($row[2])).’
‘;
}
}
else
echo ‘Error fetching data’;
?>
`Now I would like to get the most fresh topics under a certain parent. So I know I can do something like:
`$forumslist1 = $wpdb->get_results(“SELECT post_title, guid, post_date, post_modified, post_type, post_parent from wp_posts where post_type LIKE ‘topic’ && post_parent LIKE ’1263′ ORDER by post_modified DESC limit 3″,”ARRAY_N”);`
but how can I order those by freshness? You can see I tried to order them by post_modified but I didnt have luck there…
So I need to know how to get the freshest topics…
Thanks,
Mario
You must be logged in to reply to this topic.