@milanmk
15 years, 4 months ago
Kunal,
Add my code after the following line in home.php of BBP Home theme:
<div id="right-column">
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); if ($topics) { foreach ($topics as $topic) { print ' <div class="home-box-item"> <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'] . ' </div> '; } } else { 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.
@Burt
Thanks a lot for the function reference.
15 years, 5 months ago
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?