PluginProbe
Gutenberg / 16.2.0
Gutenberg v16.2.0
24.1.0 24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 All 404 releases
gutenberg / lib / compat / wordpress-6.3 / block-template-utils.php

block-template-utils.php in Gutenberg 16.2.0, at lib/compat/wordpress-6.3/block-template-utils.php

151 lines 6.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Temporary compatibility shims for features present in Gutenberg.
4 * This file should be removed when WordPress 6.3.0 becomes the lowest
5 * supported version by this plugin.
6 *
7 * @package gutenberg
8 */
9
10 /**
11 * Updates the list of default template types, containing their
12 * localized titles and descriptions.
13 *
14 * We will only need to update `get_default_block_template_types` function.
15 *
16 * @param array $default_template_types The default template types.
17 *
18 * @return array The default template types.
19 */
20 function gutenberg_get_default_block_template_types( $default_template_types ) {
21 if ( isset( $default_template_types['index'] ) ) {
22 $default_template_types['index'] = array(
23 'title' => _x( 'Index', 'Template name', 'gutenberg' ),
24 'description' => __(
25 'Used as a fallback template for all pages when a more specific template is not defined.',
26 'gutenberg'
27 ),
28 );
29 }
30 if ( isset( $default_template_types['home'] ) ) {
31 $default_template_types['home'] = array(
32 'title' => _x( 'Blog Home', 'Template name', 'gutenberg' ),
33 'description' => __(
34 'Displays the latest posts as either the site homepage or as the "Posts page" as defined under reading settings. If it exists, the Front Page template overrides this template when posts are shown on the homepage.',
35 'gutenberg'
36 ),
37 );
38 }
39 if ( isset( $default_template_types['front-page'] ) ) {
40 $default_template_types['front-page'] = array(
41 'title' => _x( 'Front Page', 'Template name', 'gutenberg' ),
42 'description' => __(
43 "Displays your site's homepage, whether it is set to display latest posts or a static page. The Front Page template takes precedence over all templates.",
44 'gutenberg'
45 ),
46 );
47 }
48 if ( isset( $default_template_types['singular'] ) ) {
49 $default_template_types['singular'] = array(
50 'title' => _x( 'Single Entries', 'Template name', 'gutenberg' ),
51 'description' => __(
52 '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.',
53 'gutenberg'
54 ),
55 );
56 }
57 if ( isset( $default_template_types['single'] ) ) {
58 $default_template_types['single'] = array(
59 'title' => _x( 'Single Posts', 'Template name', 'gutenberg' ),
60 'description' => __( 'Displays single posts on your website unless a custom template has been applied to that post or a dedicated template exists.', 'gutenberg' ),
61 );
62 }
63 if ( isset( $default_template_types['page'] ) ) {
64 $default_template_types['page'] = array(
65 'title' => _x( 'Pages', 'Template name', 'gutenberg' ),
66 'description' => __( 'Display all static pages unless a custom template has been applied or a dedicated template exists.', 'gutenberg' ),
67 );
68 }
69 if ( isset( $default_template_types['archive'] ) ) {
70 $default_template_types['archive'] = array(
71 'title' => _x( 'All Archives', 'Template name', 'gutenberg' ),
72 'description' => __(
73 '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.',
74 'gutenberg'
75 ),
76 );
77 }
78 if ( isset( $default_template_types['author'] ) ) {
79 $default_template_types['author'] = array(
80 'title' => _x( 'Author Archives', 'Template name', 'gutenberg' ),
81 'description' => __(
82 "Displays a single author's post archive. This template will serve as a fallback when a more a specific template (e.g., Author: Admin) cannot be found.",
83 'gutenberg'
84 ),
85 );
86 }
87 if ( isset( $default_template_types['category'] ) ) {
88 $default_template_types['category'] = array(
89 'title' => _x( 'Category Archives', 'Template name', 'gutenberg' ),
90 'description' => __(
91 'Displays a post category archive. This template will serve as a fallback when more specific template (e.g., Category: Recipes) cannot be found.',
92 'gutenberg'
93 ),
94 );
95 }
96 if ( isset( $default_template_types['taxonomy'] ) ) {
97 $default_template_types['taxonomy'] = array(
98 'title' => _x( 'Taxonomy', 'Template name', 'gutenberg' ),
99 'description' => __(
100 '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.',
101 'gutenberg'
102 ),
103 );
104 }
105 if ( isset( $default_template_types['date'] ) ) {
106 $default_template_types['date'] = array(
107 'title' => _x( 'Date Archives', 'Template name', 'gutenberg' ),
108 'description' => __( 'Displays a post archive when a specific date is visited (e.g., example.com/2023/).', 'gutenberg' ),
109 );
110 }
111 if ( isset( $default_template_types['tag'] ) ) {
112 $default_template_types['tag'] = array(
113 'title' => _x( 'Tag Archives', 'Template name', 'gutenberg' ),
114 'description' => __(
115 'Displays a post tag archive. This template will serve as a fallback when more specific template (e.g., Tag: Pizza) cannot be found.',
116 'gutenberg'
117 ),
118 );
119 }
120 if ( isset( $default_template_types['attachment'] ) ) {
121 $default_template_types['attachment'] = array(
122 'title' => _x( 'Attachment Pages', 'Template name', 'gutenberg' ),
123 'description' => __( 'Displays when a visitor views the dedicated page that exists for any media attachment.', 'gutenberg' ),
124 );
125 }
126 if ( isset( $default_template_types['search'] ) ) {
127 $default_template_types['search'] = array(
128 'title' => _x( 'Search Results', 'Template name', 'gutenberg' ),
129 'description' => __( 'Displays when a visitor performs a search on your website.', 'gutenberg' ),
130 );
131 }
132 if ( isset( $default_template_types['privacy-policy'] ) ) {
133 $default_template_types['privacy-policy'] = array(
134 'title' => _x( 'Privacy Policy', 'Template name', 'gutenberg' ),
135 'description' => __(
136 "Displays your site's Privacy Policy page.",
137 'gutenberg'
138 ),
139 );
140 }
141 if ( isset( $default_template_types['404'] ) ) {
142 $default_template_types['404'] = array(
143 'title' => _x( 'Page: 404', 'Template name', 'gutenberg' ),
144 'description' => __( 'Displays when a visitor views a non-existent page, such as a dead link or a mistyped URL.', 'gutenberg' ),
145 );
146 }
147
148 return $default_template_types;
149 }
150 add_filter( 'default_template_types', 'gutenberg_get_default_block_template_types', 10 );
151