From 6648c30823645172c566ff244812762b866b063d Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Thu, 4 Nov 2010 18:33:50 +0000 Subject: [PATCH] Translate and prettify post formats for display. Also, filterable by themes/plugins to add new ones. see #14746 git-svn-id: https://develop.svn.wordpress.org/trunk@16191 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/meta-boxes.php | 6 ++++-- wp-includes/post.php | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php index becfbd3db2..8d71d02e72 100644 --- a/wp-admin/includes/meta-boxes.php +++ b/wp-admin/includes/meta-boxes.php @@ -158,11 +158,13 @@ echo esc_html( $visibility_trans ); ?> if ( 'post' == $post->post_type && current_theme_supports( 'post-formats' ) ) : $post_formats = get_theme_support( 'post-formats' ); +$post_formats_display = get_post_format_strings(); + if ( is_array( $post_formats[0] ) ) : $post_format = get_post_format( $post->ID ); if ( !$post_format ) $post_format = '0'; - $post_format_display = ( $post_format ) ? $post_format : __('Default'); + $post_format_display = $post_formats_display[$post_format]; ?>
@@ -173,7 +175,7 @@ if ( is_array( $post_formats[0] ) ) : diff --git a/wp-includes/post.php b/wp-includes/post.php index 7fb95180d9..2927b71878 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -5212,4 +5212,24 @@ function wp_quickpress_form( $args = array(), $post_type = 'post'){ endif; } +/** + * Returns an array of post format slugs to their translated and pretty display versions + * + * @return array The array of translations + */ +function get_post_format_strings() { + $strings = array( + '0' => _x( 'Default', 'Post format' ), + 'aside' => _x( 'Aside', 'Post format' ), + 'chat' => _x( 'Chat', 'Post format' ), + 'gallery' => _x( 'Gallery', 'Post format' ), + 'link' => _x( 'Link', 'Post format' ), + 'image' => _x( 'Image', 'Post format' ), + 'quote' => _x( 'Quote', 'Post format' ), + 'status' => _x( 'Status', 'Post format' ), + 'video' => _x( 'Video', 'Post format' ) + ); + return apply_filters( 'post_format_strings', $strings ); +} + ?>