WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/04/2010 07:41:07 AM (9 years ago)
Author:
markjaquith
Message:

add_theme_support( 'post-formats', array( 'aside', 'image', 'etc' ) ); Add UI for choosing a post format, and save the choice. see #14746

File:
1 edited

Legend:

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

    r16171 r16174  
    154154
    155155</div><?php // /misc-pub-section ?>
     156
     157<?php
     158$post_formats = get_theme_support( 'post-formats' );
     159
     160if ( is_array( $post_formats[0] ) ) :
     161    $post_format = get_post_format( $post->ID );
     162    if ( !$post_format )
     163        $post_format = '0';
     164    $post_format_display = ( $post_format ) ? $post_format : __('Default');
     165?>
     166<div class="misc-pub-section" id="post-formats"><label for="post-format"><?php _e( 'Format:' ); ?></label>
     167
     168 <b><span id="post-format-display"><?php echo esc_html( $post_format_display ); ?></span></b> <a href="#post-formats-select" class="edit-post-format hide-if-no-js"><?php _e('Edit'); ?></a>
     169
     170<div id="post-formats-select" class="hide-if-js">
     171<input type="hidden" id="old-post-format" value="<?php echo esc_attr( $post_format ); ?>" />
     172<select id="post-format" name="post_format">
     173    <option value="0" <?php selected( $post_format, '0' ); ?>><?php _e('Default'); ?></option>
     174    <?php foreach ( $post_formats[0] as $format ) : ?>
     175    <option value="<?php echo esc_attr( $format ); ?>" <?php selected( $post_format, $format ); ?>><?php echo esc_html( $format ); ?></option>
     176    <?php endforeach; ?>
     177</select>
     178     <a href="#post-formats" class="save-post-format hide-if-no-js button"><?php _e('OK'); ?></a>
     179     <a href="#post-formats" class="cancel-post-format hide-if-no-js"><?php _e('Cancel'); ?></a>
     180</div>
     181</div><?php // /misc-pub-section ?>
     182<?php endif; ?>
    156183
    157184
Note: See TracChangeset for help on using the changeset viewer.