Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to reorder topics in one forum?


  • demonboy
    Participant

    @demonboy

    I’ve set up some FAQs as topics in a closed forum and would like to re-order them. I came across this code:

    //* 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 '     );

    … but when I added it to my functions.php file it hid all the topics (even though at forum archive level it displayed the correct number of topics in the topic count column). Removing it returned my topics.

    Any pointers?

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

  • Robin W
    Moderator

    @robin-w

    did it hide the topics in that forums or in all forums?


    demonboy
    Participant

    @demonboy

    Ha, good question. I tested again and it did it for all forums.


    Robin W
    Moderator

    @robin-w

    syntax error

    line

    add_filter('bbp_before_has_topics_parse_args', 'my_custom_display_topic_index_query ' );

    should read

    
    add_filter('bbp_before_has_topics_parse_args', 'my_custom_display_topic_index_query' );

    is essence you have a space after the word query before the ‘ in 'my_custom_display_topic_index_query '


    demonboy
    Participant

    @demonboy

    Brilliant! There’s no way I would have spotted that, at least not for a while. Thanks, Robin.


    Robin W
    Moderator

    @robin-w

    no problem

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar