Make WordPress Core

Ticket #42421: 42421.patch

File 42421.patch, 3.9 KB (added by nicolalaserra, 7 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.

  • src/wp-admin/includes/class-wp-links-list-table.php

     
    108108                                'orderby' => 'name',
    109109                        );
    110110
    111                         echo '<label class="screen-reader-text" for="cat_id">' . __( 'Filter by category' ) . '</label>';
     111                        echo '<label class="screen-reader-text" for="cat_id">' . get_taxonomy( 'link_category' )->labels->filter_by_category . '</label>';
    112112                        wp_dropdown_categories( $dropdown_options );
    113113                        submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
    114114?>
  • src/wp-admin/includes/class-wp-list-table.php

     
    553553
    554554                $m = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0;
    555555?>
    556                 <label for="filter-by-date" class="screen-reader-text"><?php _e( 'Filter by date' ); ?></label>
     556                <label for="filter-by-date" class="screen-reader-text"><?php get_post_type_object( $post_type )->labels->filter_by_date; ?></label>
    557557                <select name="m" id="filter-by-date">
    558558                        <option<?php selected( $m, 0 ); ?> value="0"><?php _e( 'All dates' ); ?></option>
    559559<?php
  • src/wp-admin/includes/class-wp-posts-list-table.php

     
    442442                                'selected' => $cat
    443443                        );
    444444
    445                         echo '<label class="screen-reader-text" for="cat">' . __( 'Filter by category' ) . '</label>';
     445                        echo '<label class="screen-reader-text" for="cat">' . get_post_type_object( $post_type )->labels->filter_by_category . '</label>';
    446446                        wp_dropdown_categories( $dropdown_options );
    447447                }
    448448        }
  • src/wp-includes/post.php

     
    14061406                'filter_items_list' => array( __( 'Filter posts list' ), __( 'Filter pages list' ) ),
    14071407                'items_list_navigation' => array( __( 'Posts list navigation' ), __( 'Pages list navigation' ) ),
    14081408                'items_list' => array( __( 'Posts list' ), __( 'Pages list' ) ),
     1409                'filter_by_category' => array( _x( 'Filter by category', 'post' ), _x( 'Filter by category', 'page' ) ),
     1410                'filter_by_date' => array( _x( 'Filter by date', 'post' ), _x( 'Filter by date', 'page' ) ),
    14091411        );
    14101412        $nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name'];
    14111413
  • src/wp-includes/taxonomy.php

     
    121121                        'add_or_remove_items' => null,
    122122                        'choose_from_most_used' => null,
    123123                        'back_to_items' => __( '&larr; Back to Link Categories' ),
     124                        'filter_by_category' => __( 'Filter by category' ),
    124125                ),
    125126                'capabilities' => array(
    126127                        'manage_terms' => 'manage_links',
  • tests/phpunit/tests/xmlrpc/wp/getPostType.php

     
    9595                $this->assertInternalType( 'string', $result['labels']['all_items'] );
    9696                $this->assertInternalType( 'string', $result['labels']['menu_name'] );
    9797                $this->assertInternalType( 'string', $result['labels']['name_admin_bar'] );
     98                $this->assertInternalType( 'string', $result['labels']['filter_by_category'] );
     99                $this->assertInternalType( 'string', $result['labels']['filter_by_date'] );
    98100
    99101                // check cap data types
    100102                $this->assertInternalType( 'string', $result['cap']['edit_post'] );