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/media.php

    r23840 r23843  
    20442044    if ( has_post_format( $type ) ) {
    20452045        $meta = get_post_format_meta( $post->ID );
    2046         if ( ! empty( $meta['media'] ) ) {
    2047             if ( is_numeric( $meta['media'] ) ) {
    2048                 $url = wp_get_attachment_url( $meta['media'] );
     2046        if ( ! empty( $meta[$type] ) ) {
     2047            if ( is_integer( $meta[$type] ) ) {
     2048                $url = wp_get_attachment_url( $meta[$type] );
    20492049                $shortcode = sprintf( '[%s src="%s"]', $type, $url );
    2050             } elseif ( preg_match( '/' . get_shortcode_regex() . '/s', $meta['media'] ) ) {
    2051                 $shortcode = $meta['media'];
    2052             } elseif ( preg_match( '#<[^>]+>#', $meta['media'] ) ) {
    2053                 $post->format_content = $meta['media'];
     2050            } elseif ( preg_match( '/' . get_shortcode_regex() . '/s', $meta[$type] ) ) {
     2051                $shortcode = $meta[$type];
     2052            } elseif ( preg_match( '#<[^>]+>#', $meta[$type] ) ) {
     2053                $post->format_content = $meta[$type];
    20542054                return $post->format_content;
    2055             } elseif ( 0 === strpos( $meta['media'], 'http' ) ) {
    2056                 $post->split_content = str_replace( $meta['media'], '', $post->post_content, $count );
    2057                 if ( strstr( $meta['media'], home_url() ) ) {
    2058                     $shortcode = sprintf( '[%s src="%s"]', $type, $meta['media'] );
     2055            } elseif ( 0 === strpos( $meta[$type], 'http' ) ) {
     2056                $post->split_content = str_replace( $meta[$type], '', $post->post_content, $count );
     2057                if ( strstr( $meta[$type], home_url() ) ) {
     2058                    $shortcode = sprintf( '[%s src="%s"]', $type, $meta[$type] );
    20592059                } else {
    2060                     $post->format_content = $wp_embed->autoembed( $meta['media'] );
     2060                    $post->format_content = $wp_embed->autoembed( $meta[$type] );
    20612061                    return $post->format_content;
    20622062                }
Note: See TracChangeset for help on using the changeset viewer.