Make WordPress Core


Ignore:
Timestamp:
03/29/2013 03:35:41 AM (11 years ago)
Author:
markjaquith
Message:

Post Format UI.

  • Icons
  • Selection
  • Prompt text
  • Special fields
  • Styling
  • Sparkles

This is going to need testing, polish, and love.

see #19570. props melchoyce, helen, wonderboymusic, lessbloat, rachelbaker, aaroncampbell, DrewAPicture, ryelle.

File:
1 edited

Legend:

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

    r23836 r23843  
    8585        'quote_source' => '',
    8686        'url'          => '',
    87         'media'        => '',
     87        'image'        => '',
     88        'gallery'      => '',
     89        'audio'        => '',
     90        'video'        => '',
    8891    );
    8992
     
    352355        case 'video':
    353356        case 'audio':
    354             if ( ! has_shortcode( $post->post_content, $format ) && ! empty( $meta['media'] ) ) {
     357            if ( ! has_shortcode( $post->post_content, $format ) && ! empty( $meta[$format] ) ) {
     358                // the metadata is an attachment ID
     359                if ( is_numeric( $meta[$format] ) ) {
     360                    $url = wp_get_attachment_url( $meta[$format] );
     361                    $format_output .= sprintf( '[%s src="%s"]', $format, $url );
    355362                // the metadata is a shortcode or an embed code
    356                 if ( preg_match( '/' . get_shortcode_regex() . '/s', $meta['media'] ) || preg_match( '#<[^>]+>#', $meta['media'] ) ) {
    357                     $format_output .= $meta['media'];
    358                 } elseif ( ! stristr( $content, $meta['media'] ) ) {
     363                } elseif ( preg_match( '/' . get_shortcode_regex() . '/s', $meta[$format] ) || preg_match( '#<[^>]+>#', $meta[$format] ) ) {
     364                    $format_output .= $meta[$format];
     365                } elseif ( ! stristr( $content, $meta[$format] ) ) {
    359366                    // attempt to embed the URL
    360                     $format_output .= sprintf( '[embed]%s[/embed]', $meta['media'] );
     367                    $format_output .= sprintf( '[embed]%s[/embed]', $meta[$format] );
    361368                }
    362369            }
Note: See TracChangeset for help on using the changeset viewer.