Make WordPress Core


Ignore:
Timestamp:
02/18/2013 07:11:24 PM (12 years ago)
Author:
helen
Message:

Edit screen UI for post formats: a first run for functionality.

  • Adds a very basic tabbed interface for selecting a post format (requires JS).
  • Extra fields, which are post meta, are shown/hidden based on the selected format.
  • Introduce a helper function for retrieving formats-specific metadata: get_post_format_meta().
  • Image selection uses the media modal, although without filtering or from URL support at the moment.

props rachelbaker, wonderboymusic, aaroncampbell, helen. see #19570.

File:
1 edited

Legend:

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

    r23416 r23449  
    194194    // Post Formats
    195195    if ( isset( $post_data['post_format'] ) ) {
    196         if ( current_theme_supports( 'post-formats', $post_data['post_format'] ) )
    197             set_post_format( $post_ID, $post_data['post_format'] );
    198         elseif ( '0' == $post_data['post_format'] )
    199             set_post_format( $post_ID, false );
     196        set_post_format( $post_ID, $post_data['post_format'] );
     197    }
     198
     199    if ( isset( $post_data[ '_wp_format_url' ] ) ) {
     200        update_post_meta( $post_ID, '_wp_format_url', addslashes( esc_url_raw( stripslashes( $post_data['_wp_format_url'] ) ) ) );
     201    }
     202
     203    $format_keys = array( 'quote', 'quote_source', 'image', 'gallery', 'media' );
     204
     205    foreach ( $format_keys as $key ) {
     206        if ( isset( $post_data[ '_wp_format_' . $key ] ) )
     207            update_post_meta( $post_ID, '_wp_format_' . $key, wp_filter_post_kses( $post_data[ '_wp_format_' . $key ] ) );
    200208    }
    201209
Note: See TracChangeset for help on using the changeset viewer.