New replies first
-
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 3You can do this:
– Reply 3
– Reply 2
– Reply 1
– Initial post
-
Yes please, I’m looking for the same functionality?
Yes. I need this also. I would like:
Initial post
– reply 3
– reply 2
– reply 1Maybe 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.
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
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.?
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.
No sorry, the shortcode uses it’s own method, and without a re-write there’s no quick way to fix this.
@Robin W
Is the shortcode method something that could be edited? I could really use this functionality, but only on certain sub-forums/topics.
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
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?
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.
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.
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!
If I remember correctly I think this allows you sort replies in a topic on a per forum basis.
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?
- You must be logged in to reply to this topic.