2

The default setting in the bbpress forum topics is that the most active topic automatically gets on top (sorted by freshness). However, I wish to change this setting in descending order of topics created or by topic id. I have tried to locate the template file to make these changes but could not get. Any help is appreciated.

1

Add this to a plugin or your active themes functions.php

function my_custom_display_topic_index_query () {
  $args['orderby'] = 'date';
  $args['order']   = 'DESC';

  return $args;
}
add_filter('bbp_before_has_topics_parse_args', 'my_custom_display_topic_index_query' );
0

You should also include the $args argument. Here is an example where the sort order of topics is changed for just one forum:

//* Change sort order of Topics within a specified bbpress forum
function my_custom_display_topic_index_query ($args) {
  $thisforumid = bbp_get_forum_id();

  if($thisforumid == 43135) {
    $args['orderby'] = 'date';
    $args['order']   = 'ASC';
  }

  return $args;
}
add_filter('bbp_before_has_topics_parse_args', 'my_custom_display_topic_index_query '     );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.