WordPress.org

Make WordPress Core

Opened 5 years ago

Last modified 4 years ago

#8755 new defect (bug)

Should be able to specify page order with wp_list_comments()

Reported by: marky Owned by:
Milestone: Future Release Priority: normal
Severity: major Version: 2.7
Component: Comments Keywords: needs-patch
Focuses: Cc:

Description

Passing the parameters reverse_top_level and reverse_children into the wp_list_comments() function only reverses the order of the comments on each page, and not the entire comment list overall. It is therefore impossible to display the newest comments first using this function, when comments are great enough to be paged. At least, not without globally changing the comment order for the entire site using the Discussion settings screen so that the "last" page is displayed first.

It should be possible to specify the page order in wp_list_comments() by, for example, passing a page_order parameter with 'asc' or 'desc' available.

Attachments (1)

8755.patch (1.5 KB) - added by Viper007Bond 5 years ago.
Don't commit me

Download all attachments as: .zip

Change History (13)

comment:1 marky5 years ago

  • Milestone changed from 2.7.1 to 2.8

comment:2 Viper007Bond5 years ago

  • Owner set to Viper007Bond

Viper007Bond5 years ago

Don't commit me

comment:3 follow-up: Viper007Bond5 years ago

This is a lot trickier than it may seem, namely due to how the paging links work as they are going off the option, especially any paging links that take place before wp_list_comments().

I'm almost thinking if you really want to force the default page via the theme that you do it via functions.php and then get_option() filter.

comment:4 in reply to: ↑ 3 ; follow-up: marky5 years ago

Replying to Viper007Bond:

This is a lot trickier than it may seem, namely due to how the paging links work as they are going off the option, especially any paging links that take place before wp_list_comments().

Then could the option to reverse the page order be provided to the previous_comments_link() and next_comments_link() functions instead?

Specifying the comment order---even across pages---seems like a reasonable feature, and I just don't believe that putting a custom hack into functions.php would be an acceptable solution to it.

Personally, I think it would be nice to even allow the newest comments appear on page 1, even though it would break the permalinks, if the designer so chooses.

comment:5 in reply to: ↑ 4 Viper007Bond5 years ago

Replying to marky:

Personally, I think it would be nice to even allow the newest comments appear on page 1, even though it would break the permalinks, if the designer so chooses.

That was done entirely on purpose. Page 1 will always contain the oldest posts regardless of settings, but you can control if page 1 or the latest page shows up by default.

If newest comments were added to /post/comments-page-1/, then older comments would constantly be changing pages. It'd be impossible to link to a particular comment and it'd also be bad for Google results. What if a Google result was a comment on a post/page but when you went there, the comment wasn't there?

comment:6 Viper007Bond5 years ago

  • Owner Viper007Bond deleted

comment:7 follow-up: marky5 years ago

Well, this is probably a discussion for a different issue, but isn't that precisely how blog posts themselves are organised? Going to /blog/page/2/, /blog/page/3/, etc. Every day, the content at those URLs might be different. I agree that there are consequences to choosing such an option for comments, but shouldn't it ultimately be up to the blog's administrator to decide this?

comment:8 Denis-de-Bernardy5 years ago

  • Keywords needs-patch added; wp_list_comments page order removed
  • Severity changed from normal to major
  • Type changed from enhancement to defect (bug)

this is not an enhancement, it's a bug.

comment:9 in reply to: ↑ 7 Viper007Bond5 years ago

Replying to marky:

Well, this is probably a discussion for a different issue, but isn't that precisely how blog posts themselves are organised? Going to /blog/page/2/, /blog/page/3/, etc. Every day, the content at those URLs might be different.

Except when you link to a single post, you link to /blog/2009/05/02/post-name/ or whatever, not /blog/page/2/#post-123.

If I post (on my blog) a link to a specific comment on your blog, that link should be valid a day, a week, or even a year from now regardless of how many comments come after. The only exception is if you change how many comments are displayed per page and not much can be done about that other than using a query var (which I have fooled around with in the past, but finally opted not to use).

comment:10 Denis-de-Bernardy5 years ago

  • Milestone changed from 2.8 to Future Release

punting to future, pending patch

comment:11 Denis-de-Bernardy5 years ago

  • Milestone changed from Future Release to 2.9

comment:12 ryan4 years ago

  • Milestone changed from 2.9 to Future Release
Note: See TracTickets for help on using tickets.