Skip to content

Commit

Permalink
Post formats: Make title and description human readable (WordPress#69275
Browse files Browse the repository at this point in the history
)

* Post formats: Make title and description human readable

Co-authored-by: carolinan <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
  • Loading branch information
4 people authored Feb 24, 2025
1 parent cca7615 commit b06588e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
29 changes: 29 additions & 0 deletions lib/compat/wordpress-6.8/block-template-utils.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/**
* Make the title and description of the post format templates human readable.
*
* @param array $default_template_types Default template types.
* @return array Filtered template type data.
*/
function gutenberg_post_format_template_title_description( $default_template_types ) {
$post_formats = get_post_format_strings();

foreach ( $post_formats as $post_format_slug => $post_format_name ) {
$default_template_types[ 'taxonomy-post_format-post-format-' . $post_format_slug ] = array(
'title' => sprintf(
/* translators: %s: Post format name. */
_x( 'Post Format: %s', 'Template name' ),
$post_format_name
),
'description' => sprintf(
/* translators: %s: Post format name. */
__( 'Displays the %s post format archive.' ),
$post_format_name
),
);
}
return $default_template_types;
}

add_filter( 'default_template_types', 'gutenberg_post_format_template_title_description', 10, 1 );
1 change: 1 addition & 0 deletions lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ function gutenberg_is_experiment_enabled( $name ) {
require __DIR__ . '/compat/wordpress-6.8/post.php';
require __DIR__ . '/compat/wordpress-6.8/site-editor.php';
require __DIR__ . '/compat/wordpress-6.8/class-gutenberg-rest-user-controller.php';
require __DIR__ . '/compat/wordpress-6.8/block-template-utils.php';

// Experimental features.
require __DIR__ . '/experimental/block-editor-settings-mobile.php';
Expand Down

0 comments on commit b06588e

Please sign in to comment.