--- a/wp/wp-includes/class-wp-theme.php Tue Dec 15 15:52:01 2020 +0100
+++ b/wp/wp-includes/class-wp-theme.php Wed Sep 21 18:19:35 2022 +0200
@@ -59,6 +59,7 @@
'twentyseventeen' => 'Twenty Seventeen',
'twentynineteen' => 'Twenty Nineteen',
'twentytwenty' => 'Twenty Twenty',
+ 'twentytwentyone' => 'Twenty Twenty-One',
);
/**
@@ -1140,7 +1141,7 @@
return false;
}
- foreach ( array( 'png', 'gif', 'jpg', 'jpeg' ) as $ext ) {
+ foreach ( array( 'png', 'gif', 'jpg', 'jpeg', 'webp' ) as $ext ) {
if ( file_exists( $this->get_stylesheet_directory() . "/screenshot.$ext" ) ) {
$this->cache_add( 'screenshot', 'screenshot.' . $ext );
if ( 'relative' === $uri ) {
@@ -1181,6 +1182,7 @@
* Returns the theme's post templates.
*
* @since 4.7.0
+ * @since 5.8.0 Include block templates.
*
* @return string[] Array of page templates, keyed by filename and post type,
* with the value of the translated header name.
@@ -1218,6 +1220,15 @@
}
}
+ if ( current_theme_supports( 'block-templates' ) ) {
+ $block_templates = get_block_templates( array(), 'wp_template' );
+ foreach ( get_post_types( array( 'public' => true ) ) as $type ) {
+ foreach ( $block_templates as $block_template ) {
+ $post_templates[ $type ][ $block_template->slug ] = $block_template->title;
+ }
+ }
+ }
+
$this->cache_add( 'post_templates', $post_templates );
}
@@ -1257,7 +1268,7 @@
* @since 4.9.6
*
* @param string[] $post_templates Array of template header names keyed by the template file name.
- * @param WP_Theme $this The theme object.
+ * @param WP_Theme $theme The theme object.
* @param WP_Post|null $post The post being edited, provided for context, or null.
* @param string $post_type Post type to get the templates for.
*/
@@ -1268,12 +1279,18 @@
*
* The dynamic portion of the hook name, `$post_type`, refers to the post type.
*
+ * Possible hook names include:
+ *
+ * - `theme_post_templates`
+ * - `theme_page_templates`
+ * - `theme_attachment_templates`
+ *
* @since 3.9.0
* @since 4.4.0 Converted to allow complete control over the `$page_templates` array.
* @since 4.7.0 Added the `$post_type` parameter.
*
* @param string[] $post_templates Array of template header names keyed by the template file name.
- * @param WP_Theme $this The theme object.
+ * @param WP_Theme $theme The theme object.
* @param WP_Post|null $post The post being edited, provided for context, or null.
* @param string $post_type Post type to get the templates for.
*/