WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 12 days ago

#42421 reviewing enhancement

Move "Filter by" strings into labels arrays of registrations

Reported by: johnjamesjacoby Owned by: SergeyBiryukov
Milestone: 5.7 Priority: normal
Severity: normal Version:
Component: Administration Keywords: good-first-bug has-patch needs-dev-note
Focuses: administration Cc:

Description

WordPress admin includes a few "Filter by" strings. They are largely used in screen-reader text.

  • "Filter by category" is used 2 times
  • "Filter by type" is used 1 time in media
  • "Filter by comment type" is used 1 time in comments
  • "Filter by date" is used once as a generic List Table string

The first 3 could be included as part of the post type and taxonomy labels. The last 1 is in the months_dropdown() method in the base list table class, and I guess could go either way.

The benefit of adding these to the labels arrays is these strings can be re-used in other places, not repeated, and custom post types and taxonomies won't need to hard-code their strings in with their mark-up, and can instead register them with the other labels.

Attachments (2)

42421.patch (3.9 KB) - added by nicolalaserra 3 years ago.
In this patch I add two new labels ( filter_by_category and filter_by_date ) inside get_post_type_labels in orther to avoid using it directly in views and thus having them duplicated.
42421.1.diff (4.4 KB) - added by audrasjb 12 days ago.
Patch refresh and small PHP fix

Download all attachments as: .zip

Change History (10)

#1 @johnbillion
3 years ago

  • Keywords good-first-bug added

#2 @SergeyBiryukov
3 years ago

  • Component changed from General to Administration

@nicolalaserra
3 years ago

In this patch I add two new labels ( filter_by_category and filter_by_date ) inside get_post_type_labels in orther to avoid using it directly in views and thus having them duplicated.

#3 @Junaidkbr
3 years ago

  • Keywords has-patch needs-testing added; needs-patch removed

#4 @DrewAPicture
3 years ago

  • Keywords dev-feedback added
  • Owner set to nicolalaserra
  • Status changed from new to assigned

Assigning to mark the good-first-bug as "claimed". @johnjamesjacoby Care to follow up here with some feedback? :-)

This ticket was mentioned in Slack in #core by sergey. View the logs.


8 weeks ago

#6 @SergeyBiryukov
8 weeks ago

  • Milestone changed from Awaiting Review to 5.7
  • Owner changed from nicolalaserra to SergeyBiryukov
  • Status changed from assigned to reviewing

@audrasjb
12 days ago

Patch refresh and small PHP fix

#7 @audrasjb
12 days ago

  • Keywords needs-testing dev-feedback removed

Hi,
I added a small refresh above. Indeed, the patch was not applying cleanly against Trunk.
Plus, I added a small PHP fix on src/wp-admin/includes/class-wp-list-table.php:

<label for="filter-by-date" class="screen-reader-text"><?php get_post_type_object( $post_type )->labels->filter_by_date; ?></label>

was not displaying anything. I added the necessary echo.

I tested the patch the patch and I didn't noticed any change on the "Filter by" screen reader text, so I guess we're good to go.

Cheers,
Jb

#8 @audrasjb
12 days ago

  • Keywords needs-dev-note added

Adding this to the miscellaneous changes dev note list.

Note: See TracTickets for help on using tickets.