Make WordPress Core

Changeset 55500


Ignore:
Timestamp:
03/09/2023 04:29:13 PM (16 months ago)
Author:
hellofromTonya
Message:

Editor: Add more details to template descriptions.

The template descriptions in get_default_block_template_types() are updated to add more details. Why? These descriptions are now more prominent in 6.2 to provide a better UX experience with more helpful information.

References:

Follow-up to [54761], [54104], [54269], [53129], [52331], [52062].

Props ntsekouras, andrewserong, bph, davidbaumwald, greenshady, glendaviesnz, hellofromTonya, jameskoster, mamaduka, peterwilsoncc, sabernhardt, SergeyBiryukov.
Fixes #57892.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/block-template-utils.php

    r55493 r55500  
    116116        'index'          => array(
    117117            'title'       => _x( 'Index', 'Template name' ),
    118             'description' => __( 'Displays posts.' ),
     118            'description' => __( 'Used as a fallback template for all pages when a more specific template is not defined.' ),
    119119        ),
    120120        'home'           => array(
    121121            'title'       => _x( 'Home', 'Template name' ),
    122             'description' => __( 'Displays posts on the homepage, or on the Posts page if a static homepage is set.' ),
     122            'description' => __( 'Displays the latest posts as either the site homepage or a custom page defined under reading settings. If it exists, the Front Page template overrides this template when posts are shown on the front page.' ),
    123123        ),
    124124        'front-page'     => array(
    125125            'title'       => _x( 'Front Page', 'Template name' ),
    126             'description' => __( 'Displays the homepage.' ),
     126            'description' => __( 'Displays your site\'s front page, whether it is set to display latest posts or a static page. The Front Page template takes precedence over all templates.' ),
    127127        ),
    128128        'singular'       => array(
    129129            'title'       => _x( 'Singular', 'Template name' ),
    130             'description' => __( 'Displays a single post or page.' ),
     130            'description' => __( 'Displays any single entry, such as a post or a page. This template will serve as a fallback when a more specific template (e.g., Single Post, Page, or Attachment) cannot be found.' ),
    131131        ),
    132132        'single'         => array(
    133133            'title'       => _x( 'Single', 'Template name' ),
    134             'description' => __( 'The default template for displaying any single post or attachment.' ),
     134            'description' => __( 'Displays single posts on your website unless a custom template has been applied to that post or a dedicated template exists.' ),
    135135        ),
    136136        'page'           => array(
    137137            'title'       => _x( 'Page', 'Template name' ),
    138             'description' => __( 'Displays a single page.' ),
     138            'description' => __( 'Display all static pages unless a custom template has been applied or a dedicated template exists.' ),
    139139        ),
    140140        'archive'        => array(
    141141            'title'       => _x( 'Archive', 'Template name' ),
    142             'description' => __( 'Displays posts by a category, tag, author, or date.' ),
     142            'description' => __( 'Displays any archive, including posts by a single author, category, tag, taxonomy, custom post type, and date. This template will serve as a fallback when more specific templates (e.g., Category or Tag) cannot be found.' ),
    143143        ),
    144144        'author'         => array(
    145145            'title'       => _x( 'Author', 'Template name' ),
    146             'description' => __( 'Displays latest posts written by a single author.' ),
     146            'description' => __( 'Displays a single author\'s post archive. This template will serve as a fallback when a more specific template (e.g., Author: Admin) cannot be found.' ),
    147147        ),
    148148        'category'       => array(
    149149            'title'       => _x( 'Category', 'Template name' ),
    150             'description' => __( 'Displays latest posts from a single post category.' ),
     150            'description' => __( 'Displays a post category archive. This template will serve as a fallback when a more specific template (e.g., Category: Recipes) cannot be found.' ),
    151151        ),
    152152        'taxonomy'       => array(
    153153            'title'       => _x( 'Taxonomy', 'Template name' ),
    154             'description' => __( 'Displays latest posts from a single post taxonomy.' ),
     154            'description' => __( 'Displays a custom taxonomy archive. Like categories and tags, taxonomies have terms which you use to classify things. For example: a taxonomy named "Art" can have multiple terms, such as "Modern" and "18th Century." This template will serve as a fallback when a more specific template (e.g, Taxonomy: Art) cannot be found.' ),
    155155        ),
    156156        'date'           => array(
    157157            'title'       => _x( 'Date', 'Template name' ),
    158             'description' => __( 'Displays posts from a specific date.' ),
     158            /* translators: %s: Example URL. */
     159            'description' => sprintf(
     160                __( 'Displays a post archive when a specific date is visited (e.g., %s).' ),
     161                __( 'example.com/2023/' )
     162            ),
    159163        ),
    160164        'tag'            => array(
    161165            'title'       => _x( 'Tag', 'Template name' ),
    162             'description' => __( 'Displays latest posts with a single post tag.' ),
     166            'description' => __( 'Displays a post tag archive. This template will serve as a fallback when a more specific template (e.g., Tag: Pizza) cannot be found.' ),
    163167        ),
    164168        'attachment'     => array(
    165169            'title'       => __( 'Media' ),
    166             'description' => __( 'Displays individual media items or attachments.' ),
     170            'description' => __( 'Displays when a visitor views the dedicated page that exists for any media attachment.' ),
    167171        ),
    168172        'search'         => array(
    169173            'title'       => _x( 'Search', 'Template name' ),
    170             'description' => __( 'Displays search results.' ),
     174            'description' => __( 'Displays when a visitor performs a search on your website.' ),
    171175        ),
    172176        'privacy-policy' => array(
    173177            'title'       => __( 'Privacy Policy' ),
    174             'description' => __( 'Displays the privacy policy page.' ),
     178            'description' => __( 'Displays your site\'s Privacy Policy page.' ),
    175179        ),
    176180        '404'            => array(
    177181            'title'       => _x( '404', 'Template name' ),
    178             'description' => __( 'Displays when no content is found.' ),
     182            'description' => __( 'Displays when a visitor views a non-existent page, such as a dead link or a mistyped URL.' ),
    179183        ),
    180184    );
  • trunk/tests/phpunit/tests/block-template-utils.php

    r55493 r55500  
    135135        $this->assertSame( 'theme', $template->source );
    136136        $this->assertSame( 'Single', $template->title );
    137         $this->assertSame( 'The default template for displaying any single post or attachment.', $template->description );
     137        $this->assertSame( 'Displays single posts on your website unless a custom template has been applied to that post or a dedicated template exists.', $template->description );
    138138        $this->assertSame( 'wp_template', $template->type );
    139139
Note: See TracChangeset for help on using the changeset viewer.