Make WordPress Core

Changeset 50120


Ignore:
Timestamp:
02/01/2021 02:11:57 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Posts, Post Types: Introduce "Filter by date" and "Filter by category" as post type and taxonomy labels, respectively.

This provides a more consistent location for these strings and allows for reusing them in other places without hardcoding them in the markup.

Props nicolalaserra, audrasjb, johnjamesjacoby, SergeyBiryukov.
Fixes #42421.

Location:
trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-links-list-table.php

    r50002 r50120  
    115115            );
    116116
    117             echo '<label class="screen-reader-text" for="cat_id">' . __( 'Filter by category' ) . '</label>';
     117            echo '<label class="screen-reader-text" for="cat_id">' . get_taxonomy( 'link_category' )->labels->filter_by_item . '</label>';
    118118
    119119            wp_dropdown_categories( $dropdown_options );
  • trunk/src/wp-admin/includes/class-wp-list-table.php

    r49944 r50120  
    634634        $m = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0;
    635635        ?>
    636         <label for="filter-by-date" class="screen-reader-text"><?php _e( 'Filter by date' ); ?></label>
     636        <label for="filter-by-date" class="screen-reader-text"><?php echo get_post_type_object( $post_type )->labels->filter_by_date; ?></label>
    637637        <select name="m" id="filter-by-date">
    638638            <option<?php selected( $m, 0 ); ?> value="0"><?php _e( 'All dates' ); ?></option>
  • trunk/src/wp-admin/includes/class-wp-posts-list-table.php

    r49950 r50120  
    457457            );
    458458
    459             echo '<label class="screen-reader-text" for="cat">' . __( 'Filter by category' ) . '</label>';
     459            echo '<label class="screen-reader-text" for="cat">' . get_taxonomy( 'category' )->labels->filter_by_item . '</label>';
     460
    460461            wp_dropdown_categories( $dropdown_options );
    461462        }
  • trunk/src/wp-includes/post.php

    r50051 r50120  
    16901690 * - `filter_items_list` - Label for the table views hidden heading. Default is 'Filter posts list' /
    16911691 *                       'Filter pages list'.
     1692 * - `filter_by_date` - Label for the date filter in list tables. Default is 'Filter by date'.
    16921693 * - `items_list_navigation` - Label for the table pagination hidden heading. Default is 'Posts list navigation' /
    16931694 *                           'Pages list navigation'.
     
    17161717 * @since 5.0.0 Added the `item_published`, `item_published_privately`, `item_reverted_to_draft`,
    17171718 *              `item_scheduled`, and `item_updated` labels.
     1719 * @since 5.7.0 Added the `filter_by_date` label.
    17181720 *
    17191721 * @access private
     
    17461748        'use_featured_image'       => array( _x( 'Use as featured image', 'post' ), _x( 'Use as featured image', 'page' ) ),
    17471749        'filter_items_list'        => array( __( 'Filter posts list' ), __( 'Filter pages list' ) ),
     1750        'filter_by_date'           => array( __( 'Filter by date' ), __( 'Filter by date' ) ),
    17481751        'items_list_navigation'    => array( __( 'Posts list navigation' ), __( 'Pages list navigation' ) ),
    17491752        'items_list'               => array( __( 'Posts list' ), __( 'Pages list' ) ),
  • trunk/src/wp-includes/taxonomy.php

    r50116 r50120  
    538538 * @since 4.4.0 Added the `items_list_navigation` and `items_list` labels.
    539539 * @since 4.9.0 Added the `most_used` and `back_to_items` labels.
     540 * @since 5.7.0 Added the `filter_by_item` label.
    540541 *
    541542 * @param WP_Taxonomy $tax Taxonomy object.
     
    570571 *     @type string $no_terms                   Default 'No tags'/'No categories', used in the posts and media
    571572 *                                              list tables.
     573 *     @type string $filter_by_item             This label is only used for hierarchical taxonomies. Default
     574 *                                              'Filter by category', used in the posts list table.
    572575 *     @type string $items_list_navigation      Label for the table pagination hidden heading.
    573576 *     @type string $items_list                 Label for the table hidden heading.
     
    605608        'not_found'                  => array( __( 'No tags found.' ), __( 'No categories found.' ) ),
    606609        'no_terms'                   => array( __( 'No tags' ), __( 'No categories' ) ),
     610        'filter_by_item'             => array( null, __( 'Filter by category' ) ),
    607611        'items_list_navigation'      => array( __( 'Tags list navigation' ), __( 'Categories list navigation' ) ),
    608612        'items_list'                 => array( __( 'Tags list' ), __( 'Categories list' ) ),
Note: See TracChangeset for help on using the changeset viewer.