Skip to content

Commit 86a7c18

Browse files
authored
WP track #50120: Introduce "Filter by category" as taxonomy label and "Filter by date" for post type label (#1005)
* WP track #50120: Introduce "Filter by category" as taxonomy label * WP track #50120: Introduce "Filter by date" as post type label
1 parent 1148faf commit 86a7c18

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

inc/post-types.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,22 @@ function cptui_manage_post_types() {
747747
]
748748
);
749749

750+
echo $ui->get_text_input( // phpcs:ignore.
751+
[
752+
'labeltext' => esc_html__( 'Filter Items By Date', 'custom-post-type-ui' ),
753+
'helptext' => esc_html__( 'Label for the date filter in list tables.', 'custom-post-type-ui' ),
754+
'namearray' => 'cpt_labels',
755+
'name' => 'filter_by_date',
756+
'textvalue' => isset( $current['labels']['filter_by_date'] ) ? esc_attr( $current['labels']['filter_by_date'] ) : '', // phpcs:ignore.
757+
'aftertext' => esc_html__( '(e.g. Filter movies by date)', 'custom-post-type-ui' ),
758+
'data' => [
759+
/* translators: Used for autofill */
760+
'label' => sprintf( esc_attr__( 'Filter %s by date', 'custom-post-type-ui' ), 'item' ),
761+
'plurality' => 'plural',
762+
],
763+
]
764+
);
765+
750766
echo $ui->get_text_input( // phpcs:ignore.
751767
[
752768
'labeltext' => esc_html__( 'Items List Navigation', 'custom-post-type-ui' ),

inc/taxonomies.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,22 @@ function cptui_manage_taxonomies() {
731731
]
732732
);
733733

734+
echo $ui->get_text_input( // phpcs:ignore.
735+
[
736+
'namearray' => 'cpt_tax_labels',
737+
'name' => 'filter_by_item',
738+
'textvalue' => isset( $current['labels']['filter_by_item'] ) ? esc_attr( $current['labels']['filter_by_item'] ) : null, // phpcs:ignore.
739+
'aftertext' => esc_html__( '(e.g. Filter by actor)', 'custom-post-type-ui' ),
740+
'labeltext' => esc_html__( 'Filter by Category', 'custom-post-type-ui' ),
741+
'helptext' => esc_attr__( 'This label is only used for hierarchical taxonomies.', 'custom-post-type-ui' ),
742+
'data' => [
743+
/* translators: Used for autofill */
744+
'label' => sprintf( esc_attr__( 'Filter by %s', 'custom-post-type-ui' ), 'item' ),
745+
'plurality' => 'singular',
746+
],
747+
]
748+
);
749+
734750
echo $ui->get_text_input( // phpcs:ignore.
735751
[
736752
'namearray' => 'cpt_tax_labels',

0 commit comments

Comments
 (0)