WordPress: Display freshest 3 topics from specific forum bbpress, mysql solution

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.


Any easier way?

THanks !!!

WordPress bbpress — can’t display sidebar in custom theme

I’ve developed a custom theme in WordPress and am trying to add bbPress forums. I have numerous custom sidebars with my theme, and the default sidebar is displaying on the forums page. So I: — Regis

Rating system for bbPress

I am looking for a rating/voting system for bbPress. Comments or Topics that are rated high, should appear higher. If this isn’t possible, is there a forum, in WordPress or Rails, that supports anyth

WordPress bbpress get last 2 posts php

I’m trying to build a wordpress query to get the last 2 posts from bbpress2.3.2 to display on the home page of the site and I just can’t seem to grasp how to do this. I have been digging about in the

PHP + MySQL Forum display

I am currently building a simple PHP + MySQL forum but I am having problems with getting the information to show in the correct format. My current SQL code is SELECT forum_posts.catId, forum_posts.p

Getting myBB threads from a specific forum and display them on another page?

Hello I am trying to display up to 5 threads on my homepage from a specific forum. So I want to get the threads from ‘Announcments’ located in http://example.com/forum and display them on the homepage

wordpress plugin bbpress – login and registration form

I have bbpress installed as a plugin in a wordpress site and want to display the Login form of forums but not display registration form. I am using below login form code <?php if (!function_exists(

BBPress – Copy forum branch to another branch

I have a website that uses WordPress 4 + BBPress 2.5.4 + TinyMCE 4 (Advanced) with GoDaddy web-hosting for my website – DCJTech.info (still under construction). I want to copy these forums and sub-for

Counting forum topics and replies

I have 2 tables: posts and forum_topics. Each post (a reply) is associated with another post (a forum topic, which is then associated with the forum_topics tables). Problem: I need to count all forum

Point Forum, like bbpress, to existing database

I have an existing database with a users table and questions/answers table. I’d like to use bbpress (or any forum really) as a front end for this for access via the web. Is this possible? Has anyone d

Forum solution for Rails 3 and Devise?

I’m looking for a forum solution for a website I’m building. I’m using Devise and Rails 3, so does there exist any pluggable solutions? What about 3rd party services?


“I simply need to display the “freshest” 3 topics under a specific forum in bbpress.”

It sounds like you’re trying to take the long route to what the widgets described here already do:


If your needs differ from the widgets listed here please specify exactly why and we’ll hopefully be able to narrow it down.

Try this:

SELECT my_id, my_title, max(my_date) order_date
replace(post_title,'Antwort zu: ','') my_title,
post_date my_date,
if(strcmp(post_type,'topic'),post_parent,ID) my_id
FROM wp_posts
where post_type in ('topic', 'reply')
and post_status = 'publish'
) my_temp_table
group by my_id, my_title
order by order_date desc
limit 3

Replace ‘Antwort zu: ‘ with a string depending on your forum language.