Posted By

kristarella on 05/29/12


Tagged

WordPressWPbbPress


Versions (?)

Fix bbPress pagination


 / Published in: PHP
 

For some reason bbPress seems to use the base domain name (rather than the current forum) as the URL to which it appends /page/2 (for example) in its pagination. This seems to fix it.

  1. function fix_pagination($args) {
  2. global $wp_query,$bbp;
  3. $max_pages = $bbp->topic_query->max_num_pages;
  4. $page = $bbp->topic_query->paged;
  5. $mybase = get_permalink($wp_query->post->ID);
  6. $args = array (
  7. 'base' => $mybase.$wp_rewrite->pagination_base.'/%#%/',
  8. 'format' => '',
  9. 'total' => $max_pages,
  10. 'current' => $page,
  11. 'prev_text' => '←',
  12. 'next_text' => '→',
  13. 'mid_size' => 1
  14. );
  15. return $args;
  16. }
  17. add_filter('bbp_topic_pagination','fix_pagination');

Report this snippet  

You need to login to post a comment.