Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Custom Loops for Forum Topics

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.

Skip to toolbar