13 years, 3 months ago
Add my code after the following line in home.php of BBP Home theme:
It should get you started.
You can put the code anywhere outside of widget if…else block.
Yes I got my template running just fine.
Here is the code I use to show 5 recent topics across forum:
$topics = bp_forums_get_topics(0, 5);
foreach ($topics as $topic)
<a class="home-box-item-link" href="' . $topic['topic_uri'] . '">' . $topic['topic_title'] . '</a>
by ' . $topic['topic_poster_display_name'] . '
Freshness: ' . $topic['topic_time_since'] . '
Posts: ' . $topic['topic_posts'] . '
print '<p>No topics found.</p>';
If you want to show topics from a specific forum then you can pass the forum ID parameter like this:
$topics = bp_forums_get_topics(5, 5);<br />
PS: Sorry for late reply.
Thanks a lot for the function reference.
Oh i see, I wont be using that widget then.
Is there a way to get all forum IDs from BBPress so as to fetch posts from forums and sub-forums using bp_has_topics() function.
Thanks for the reference. Are you pointing to bp_has_topics() function?
That function needs a Forum ID and I want to instead pull latest 5 topics from the whole Forum. Is there any other function I am missing or would you suggest any workarounds?
See also: WordPress.org •
Follow BuddyPress on Twitter •
Contact Us •
Terms of Service