Make WordPress Core

Opened 19 months ago

Last modified 19 months ago

#57200 new enhancement

WP_List_Table::pagination use singular and plural

Reported by: roscohead's profile RoscoHead Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Administration Keywords: dev-feedback
Focuses: ui, administration Cc:

Description

WP_List_Table::pagination() currently hardcodes the number of records display as "1 item"/"XX items". It would be nice if it used the singular and plural set in the constructor, defaulting to item/items if none are set.

Change History (3)

This ticket was mentioned in Slack in #accessibility by ryokuhi. View the logs.


19 months ago

#2 @ryokuhi
19 months ago

  • Focuses accessibility removed

Hello @RoscoHead,

welcome on Trac and thanks for deciding to contribute to WordPress!

We reviewed this ticket today during the Accessibility Team's weekly bug scrub. As far as we were able to understand, this doesn't seem to be an accessibility issue, that is, a problem faced primarily by people with disabilities.

As such, I'm removing the corresponding focus: if we are missing something, please leave a comment and add the focus back.

#3 @costdev
19 months ago

  • Keywords dev-feedback added
  • Version 6.1.1 deleted

Hi @RoscoHead, welcome to Trac and thanks for opening this ticket!

Making this change would be nice, and can be made relatively easily to see some positive results.

However, there are at least a few things to consider:

  • The singular and plural arguments are passed through sanitize_key(). This means that, for example, media items becomes mediaitems. Therefore, we would need to consider storing another version of these sanitized in such a way that certain characters are allowed, such as spaces.
  • With this change, the Categories and Pages screens show tag|tags and post|posts respectively. Therefore, the constructor of WP_Terms_List_Table and WP_Posts_List_Table would need to be changed to correct this.
  • A list table may exist, for example, in a submenu page under a post type, and may display items of a different post type.

e.g. Menu: Books > Books per author

Books per author shows a list table of authors, the number of books each one has written, and a View Books link to filter the Books screen by author.

The post type is books and the page's slug is books-per-author, meaning the list table of authors would show 2 books_page_books-per-author, instead of 2 authors.

So, unless the constructor of the author list table is changed to set the values for singular and plural, this will show the incorrect value. This is easy to do, however, not all plugins/themes are maintained, which means implementing this change requires consideration so as not to introduce a backward compatibility break.


Adding the dev-feedback keyword to encourage discussion about this enhancement request.

Note: See TracTickets for help on using tickets.