here’s how to add front page pagination (page numbers)
-
update: I’ve now included this functionality in the topics-per-page plugin so use that instead which is maintained and not this mini-plugin which will not work properly with 1.0a
Here’s something I had made a mental note of quite awhile ago but forgot to do, add pagination to the front-page for the latest discussions. You can see a demo near the bottom of http://bbshowcase.org/forums/
(the following two functions are included in the 0.0.4 version of topics-page-page plugin, so don’t use them if you have that)
add_filter('get_latest_topics_limit','front_page_pagination',999);
function front_page_pagination($limit="") {
global $page;
if (is_front() && $page>1) {$limit.=" OFFSET ".($page-1)*bb_get_option('page_topics');}
return $limit;
}
function front_page_pages() {
global $page, $bbdb;
echo get_page_number_links( $page, $bbdb->get_var("SELECT SUM(topics) FROM $bbdb->forums"));
}1. add to your
front-page.php
template<div class="nav"><?php front_page_pages(); ?></div>
AFTER
<?php endforeach; endif; // $topics ?>
</table>2. If you use rewrite slugs you MUST add the following rule to your
.htaccess
fileRewriteRule ^page/([0-9]+)/?$ /forums/?page=$1 [L,QSA]
anywhere before
</IfModule>
where
/forums/
is the path to your bbpress install.
- You must be logged in to reply to this topic.