Skip to:
Content
Pages
Categories
Search
Top
Bottom

New replies first

  • @blg002

    Participant

    Is there a way to have replies in a topic display in reverse chronological order. i.e.

    Instead of:
    – Initial post
    – Reply 1
    – Reply 2
    – Reply 3

    You can do this:
    – Reply 3
    – Reply 2
    – Reply 1
    – Initial post

Viewing 14 replies - 1 through 14 (of 14 total)
  • @flyden

    Participant

    Yes please, I’m looking for the same functionality?

    @slprof

    Participant

    Yes. I need this also. I would like:

    Initial post
    – reply 3
    – reply 2
    – reply 1

    Maybe there’s a better way for me to do this. I post topics like “Write a journal entry” — I’m an English teacher. I don’t want to have to scroll down forever or page over. I want the latest reply by the student minus the other student’s comments to show up. Now THAT would be cool. Hm. I should post this elsewhere but I think it’s kinda related to blg002’s post.

    @robin-w

    Moderator

    @slprof

    Try putting this in your functions file

    function change_reply_order() {
    $args['order'] = 'DESC';
     return $args;
    }
    add_filter('bbp_before_has_replies_parse_args', 'change_reply_order');
    

    I haven’t tested, so come back if it doesn’t work, it should do topic then replies with latest at top

    @robin-w

    Moderator

    @slprof

    If you want to try just the latest reply, then try

    function change_reply_order() {
    $args['order'] = 'DESC';
    $args['posts_per_page'] = '1';
    return $args;
    }
    add_filter('bbp_before_has_replies_parse_args', 'change_reply_order');
    

    But I suspect it will have some weird effects on the site, and of course you’ll never see anything but the latest post, so if pupil a posts and a minute laters pupil b, then you’ll never see pupil a’s.

    or do you mean that for each topic, pupil a would be pupil a’s reply, pupil b would see pupils b’s reply etc.?

    @sandyrig

    Participant

    This does not work in the shortcodes. For example when I show a topic on a page using the shortcode [bbp-single-topic id=134]. I see the posts in descending order in the forum, but on the page its in Ascending order.

    Not sure whats going on, please help any one.

    @robin-w

    Moderator

    No sorry, the shortcode uses it’s own method, and without a re-write there’s no quick way to fix this.

    @hamncheez

    Participant

    @Robin W

    Is the shortcode method something that could be edited? I could really use this functionality, but only on certain sub-forums/topics.

    @robin-w

    Moderator

    Let me know which shortcodes you are looking to use, and try the

    function change_reply_order() {
    $args['order'] = 'DESC';
     return $args;
    }
    add_filter('bbp_before_has_replies_parse_args', 'change_reply_order');
    

    first to see if it works

    @hamncheez

    Participant

    It works great with the shortcodes I used ([bbp-single-topic id=whatever]), not sure which shortcodes SandyRig used. If I needed to control when the replies are asc or desc, what would you recommend? I’m using a custom post type; could I just add a meta box that calls the change_reply_order if checked for desc?

    @robin-w

    Moderator

    If I needed to control when the replies are asc or desc, what would you recommend? I’m using a custom post type; could I just add a meta box that calls the change_reply_order if checked for desc?

    No you really woul;d need to use filters. These work with some shortcodes.

    Where they don’t, you’d need to create a new shortcode, but if you need that come back with which and I’ll work on that.

    @hamncheez

    Participant

    I think the best UX would be a ascend/descend button for the replies. I’m trying to decide whether to just use comments for my custom post type. It would be really nice to view the thread by navigating to the forum as well as on each custom post.

    @lfeddern

    Participant

    Hey,

    is there a way of specifiying a specific forum that this snippet applies to?

    like if forum id =

    kind of thing?

    SOrry new to php!

    @robkk

    Moderator

    @lfeddern

    If I remember correctly I think this allows you sort replies in a topic on a per forum basis.

    https://wordpress.org/plugins/bbpress-sort-topic-replies/

    @seth23

    Participant

    This code worked for me. Is there any way to put an option on the topics pages for people to choose if they want the thread to go oldest to newest or newest to oldest?

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