Skip to content

add in "template_name" labels from WP 6.6 #990

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions custom-post-type-ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -1081,10 +1081,11 @@ function cptui_get_preserved_labels() {
return [
'post_types' => [
'singular' => [
'add_new_item' => esc_html__( 'Add new %s', 'custom-post-type-ui' ),
'edit_item' => esc_html__( 'Edit %s', 'custom-post-type-ui' ),
'new_item' => esc_html__( 'New %s', 'custom-post-type-ui' ),
'view_item' => esc_html__( 'View %s', 'custom-post-type-ui' ),
'add_new_item' => esc_html__( 'Add new %s', 'custom-post-type-ui' ),
'edit_item' => esc_html__( 'Edit %s', 'custom-post-type-ui' ),
'new_item' => esc_html__( 'New %s', 'custom-post-type-ui' ),
'view_item' => esc_html__( 'View %s', 'custom-post-type-ui' ),
'template_name' => esc_html__( 'Single item: %s', 'custom-post-type-ui' ),
],
'plural' => [
'view_items' => esc_html__( 'View %s', 'custom-post-type-ui' ),
Expand All @@ -1102,6 +1103,7 @@ function cptui_get_preserved_labels() {
'update_item' => esc_html__( 'Update %s', 'custom-post-type-ui' ),
'add_new_item' => esc_html__( 'Add new %s', 'custom-post-type-ui' ),
'new_item_name' => esc_html__( 'New %s name', 'custom-post-type-ui' ),
'template_name' => esc_html__( '%s Archives', 'custom-post-type-ui' ),
],
'plural' => [
'search_items' => esc_html__( 'Search %s', 'custom-post-type-ui' ),
Expand Down
17 changes: 17 additions & 0 deletions inc/post-types.php
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,23 @@ function cptui_manage_post_types() {
]
);

echo $ui->get_text_input( // phpcs:ignore.
[
'labeltext' => esc_html__( 'Template name', 'custom-post-type-ui' ),
'helptext' => esc_html__( 'Use by the site editor to display on the templates/add new template screens.', 'custom-post-type-ui' ),
'namearray' => 'cpt_labels',
'name' => 'template_name',
'textvalue' => isset( $current['labels']['template_name'] ) ? esc_attr( $current['labels']['template_name'] ) : '',
// phpcs:ignore.
'aftertext' => esc_html__( '(e.g. "Single item: Movie")', 'custom-post-type-ui' ),
'data' => [
/* translators: Used for autofill */
'label' => sprintf( esc_attr__( 'Single item: %s', 'custom-post-type-ui' ), 'item' ),
'plurality' => 'singular',
],
]
);

?>
</table>
</div>
Expand Down
17 changes: 17 additions & 0 deletions inc/taxonomies.php
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,23 @@ function cptui_manage_taxonomies() {
],
]
);

echo $ui->get_text_input( // phpcs:ignore.
[
'namearray' => 'cpt_tax_labels',
'name' => 'template_name',
'textvalue' => isset( $current['labels']['template_name'] ) ? esc_attr( $current['labels']['template_name'] ) : null,
// phpcs:ignore.
'aftertext' => esc_html__( '(e.g. "Category Archives")', 'custom-post-type-ui' ),
'labeltext' => esc_html__( 'Template name', 'custom-post-type-ui' ),
'helptext' => esc_attr__( 'Use by the site editor to display on the templates/add new template screens.', 'custom-post-type-ui' ),
'data' => [
/* translators: Used for autofill */
'label' => sprintf( esc_attr__( '%s Archives', 'custom-post-type-ui' ), 'item' ),
'plurality' => 'singular',
],
]
);
?>
</table>
</div>
Expand Down