WordPress.org

Make WordPress Core

Changeset 16191


Ignore:
Timestamp:
11/04/2010 06:33:50 PM (9 years ago)
Author:
markjaquith
Message:

Translate and prettify post formats for display. Also, filterable by themes/plugins to add new ones. see #14746

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/meta-boxes.php

    r16188 r16191  
    159159$post_formats = get_theme_support( 'post-formats' );
    160160
     161$post_formats_display = get_post_format_strings();
     162
    161163if ( is_array( $post_formats[0] ) ) :
    162164    $post_format = get_post_format( $post->ID );
    163165    if ( !$post_format )
    164166        $post_format = '0';
    165     $post_format_display = ( $post_format ) ? $post_format : __('Default');
     167    $post_format_display = $post_formats_display[$post_format];
    166168?>
    167169<div class="misc-pub-section" id="post-formats"><label for="post-format"><?php _e( 'Format:' ); ?></label>
     
    174176    <option value="0" <?php selected( $post_format, '0' ); ?>><?php _e('Default'); ?></option>
    175177    <?php foreach ( $post_formats[0] as $format ) : ?>
    176     <option value="<?php echo esc_attr( $format ); ?>" <?php selected( $post_format, $format ); ?>><?php echo esc_html( $format ); ?></option>
     178    <option value="<?php echo esc_attr( $format ); ?>" <?php selected( $post_format, $format ); ?>><?php echo esc_html( $post_formats_display[$format] ); ?></option>
    177179    <?php endforeach; ?>
    178180</select>
  • trunk/wp-includes/post.php

    r16121 r16191  
    52135213}
    52145214
     5215/**
     5216 * Returns an array of post format slugs to their translated and pretty display versions
     5217 *
     5218 * @return array The array of translations
     5219 */
     5220function get_post_format_strings() {
     5221    $strings = array(
     5222        '0'       => _x( 'Default', 'Post format' ),
     5223        'aside'   => _x( 'Aside',   'Post format' ),
     5224        'chat'    => _x( 'Chat',    'Post format' ),
     5225        'gallery' => _x( 'Gallery', 'Post format' ),
     5226        'link'    => _x( 'Link',    'Post format' ),
     5227        'image'   => _x( 'Image',   'Post format' ),
     5228        'quote'   => _x( 'Quote',   'Post format' ),
     5229        'status'  => _x( 'Status',  'Post format' ),
     5230        'video'   => _x( 'Video',   'Post format' )
     5231    );
     5232    return apply_filters( 'post_format_strings', $strings );
     5233}
     5234
    52155235?>
Note: See TracChangeset for help on using the changeset viewer.