mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Editor: Add labels for template name display in site editor.
Add the label `template_name` to post types and taxonomies for use by the site editor to display on the templates/add new template screens to allow extenders to customize the display. For post types the template name applies to templates for a singular pages with the default value "Single item: [singular name]". For taxonomies the template name applies to templates for term archives with the default value "[singular name] Archives". Props aljullu, audrasjb, ntsekouras, ellatrix, oglekler, rajinsharwar. Fixes #60881. Built from https://develop.svn.wordpress.org/trunk@58377 git-svn-id: http://core.svn.wordpress.org/trunk@57826 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ea70d42705
commit
27bdc71f33
@ -2083,6 +2083,7 @@ function _post_type_meta_capabilities( $capabilities = null ) {
|
||||
* @since 6.3.0 Added the `item_trashed` label.
|
||||
* @since 6.4.0 Changed default values for the `add_new` label to include the type of content.
|
||||
* This matches `add_new_item` and provides more context for better accessibility.
|
||||
* @since 6.6.0 Added the `template_name` label.
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
@ -2096,6 +2097,11 @@ function get_post_type_labels( $post_type_object ) {
|
||||
|
||||
$labels = _get_custom_object_labels( $post_type_object, $nohier_vs_hier_defaults );
|
||||
|
||||
if ( ! isset( $post_type_object->labels->template_name ) && isset( $post_type_object->labels->singular_name ) ) {
|
||||
/* translators: %s: Post type name. */
|
||||
$labels->template_name = sprintf( __( 'Single item: %s' ), $post_type_object->labels->singular_name );
|
||||
}
|
||||
|
||||
$post_type = $post_type_object->name;
|
||||
|
||||
$default_labels = clone $labels;
|
||||
|
@ -645,6 +645,7 @@ function unregister_taxonomy( $taxonomy ) {
|
||||
* @since 5.8.0 Added the `item_link` and `item_link_description` labels.
|
||||
* @since 5.9.0 Added the `name_field_description`, `slug_field_description`,
|
||||
* `parent_field_description`, and `desc_field_description` labels.
|
||||
* @since 6.6.0 Added the `template_name` label.
|
||||
*
|
||||
* @param WP_Taxonomy $tax Taxonomy object.
|
||||
* @return object {
|
||||
@ -679,6 +680,7 @@ function unregister_taxonomy( $taxonomy ) {
|
||||
* @type string $update_item Default 'Update Tag'/'Update Category'.
|
||||
* @type string $add_new_item Default 'Add New Tag'/'Add New Category'.
|
||||
* @type string $new_item_name Default 'New Tag Name'/'New Category Name'.
|
||||
* @type string $template_name Default 'Tag Archives'/'Category Archives'.
|
||||
* @type string $separate_items_with_commas This label is only used for non-hierarchical taxonomies. Default
|
||||
* 'Separate tags with commas', used in the meta box.
|
||||
* @type string $add_or_remove_items This label is only used for non-hierarchical taxonomies. Default
|
||||
@ -719,6 +721,11 @@ function get_taxonomy_labels( $tax ) {
|
||||
|
||||
$labels = _get_custom_object_labels( $tax, $nohier_vs_hier_defaults );
|
||||
|
||||
if ( ! isset( $tax->labels->template_name ) && isset( $labels->singular_name ) ) {
|
||||
/* translators: %s: Taxonomy name. */
|
||||
$labels->template_name = sprintf( _x( '%s Archives', 'taxonomy template name' ), $labels->singular_name );
|
||||
}
|
||||
|
||||
$taxonomy = $tax->name;
|
||||
|
||||
$default_labels = clone $labels;
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.6-beta1-58376';
|
||||
$wp_version = '6.6-beta1-58377';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user