Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Alter Loop for Paged Forum Pages?


jenz
Member

@jenz

I figured it out and wanted to share. This code goes at the top of my forums.php file (template).

<?php
$forum_id = 1;
$limit = bb_get_option('page_topics');
$offset = ($page-1)*$limit;
$forum_one_topics = $bbdb->get_results("SELECT * FROM $bbdb->topics WHERE forum_id = $forum_id AND topic_status = 0 ORDER BY topic_id DESC LIMIT $limit OFFSET $offset")
?>

My posts loop:

<?php

foreach($forum_one_topics as $topic) : $forum_one_topic_posts = get_thread( $topic->topic_id); ?>

Works like a charm

Skip to toolbar