Skip to:

Reversing order of topic, BUT leaving the original topic at the top..

  • grex22


    We’ve had a request to reorder the way a topic’s page displays, such that the original topic post would be at top, but then the subsequent replies would be below that post in newest->oldest order.

    I’ve seen snippets that filter bbp_has_replies_query() and change the ‘order’ parameter, and this works nicely for getting the order to newest->oldest. However, it ALSO throws the original topic at the very bottom of the order. We want the topic post first.

    Any ideas?

Viewing 3 replies - 1 through 3 (of 3 total)
  • So close… Indeed you use bbp_has_replies to reverse order the replies

    function custom_bbp_has_replies() {
      $args['order'] = 'DESC'; // 'ASC' (Ascending, Default), 'DESC' (Descending)
      return $args;
    add_filter('bbp_before_has_replies_parse_args', 'custom_bbp_has_replies' );

    And use bbp_show_lead_topic to always show the ‘lead topic’ (More details here.

    function custom_bbp_show_lead_topic( $show_lead ) {
      $show_lead[] = 'true';
      return $show_lead;
    add_filter('bbp_show_lead_topic', 'custom_bbp_show_lead_topic' );



    Perfect — this worked like a charm. Thanks so much for your help!



    I am currently trying do the same thing, set newest to oldest with the original topic post remaining on the top.
    I am a novice with code and CSS, and was curious where the code you provided for grex22 went. I am familiar with the .php location of bbpress, but can not find the information you posted.

    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.