diff --git a/wp-admin/js/post-formats.js b/wp-admin/js/post-formats.js
index 4a1b52737f..283fff8ad5 100644
--- a/wp-admin/js/post-formats.js
+++ b/wp-admin/js/post-formats.js
@@ -118,7 +118,7 @@ window.wp = window.wp || {};
mediaPreview('video', url, mime);
} else {
// set the hidden input's value
- $field.val(url);
+ $field.val(id);
// Show the image in the placeholder
$el.html('');
$holder.removeClass('empty').show();
diff --git a/wp-includes/media.php b/wp-includes/media.php
index dfcb62cc35..f41f63ea54 100644
--- a/wp-includes/media.php
+++ b/wp-includes/media.php
@@ -2367,6 +2367,12 @@ function get_the_image( $attached_size = 'full', &$post = null ) {
if ( isset( $post->format_content ) )
return $post->format_content;
+ $meta = get_post_format_meta( $post->ID );
+ if ( ! empty( $meta['image'] ) ) {
+ $post->format_content = wp_get_attachment_image( $meta['image'], $attached_size );
+ return $post->format_content;
+ }
+
$medias = get_attached_images();
if ( ! empty( $medias ) ) {
$media = reset( $medias );
diff --git a/wp-includes/post-formats.php b/wp-includes/post-formats.php
index 5c347748e1..9487ad0350 100644
--- a/wp-includes/post-formats.php
+++ b/wp-includes/post-formats.php
@@ -289,7 +289,7 @@ function post_formats_compat( $content, $id = 0 ) {
return $content;
$format = get_post_format( $post );
- if ( empty( $format ) || in_array( $format, array( 'status', 'aside', 'chat' ) ) )
+ if ( empty( $format ) || in_array( $format, array( 'status', 'aside', 'chat', 'gallery' ) ) )
return $content;
if ( current_theme_supports( 'structured-post-formats', $format ) )
@@ -308,8 +308,6 @@ function post_formats_compat( $content, $id = 0 ) {
$show_content = true;
$format_output = '';
$meta = get_post_format_meta( $post->ID );
- // passed by ref in preg_match()
- $matches = array();
switch ( $format ) {
case 'link':
@@ -341,11 +339,34 @@ function post_formats_compat( $content, $id = 0 ) {
}
break;
+ case 'image':
+ if ( ! empty( $meta['image'] ) ) {
+ $image = is_numeric( $meta['image'] ) ? wp_get_attachment_url( $meta['image'] ) : $meta['image'];
+
+ if ( ! empty( $image ) && ! stristr( $content, $image ) ) {
+ $image_html = sprintf(
+ '
',
+ empty( $compat['image_class'] ) ? '' : sprintf( 'class="%s" ', esc_attr( $compat['image_class'] ) ),
+ $image
+ );
+ if ( empty( $meta['url'] ) ) {
+ $format_output .= $image_html;
+ } else {
+ $format_output .= sprintf(
+ '%s',
+ esc_url( $meta['url'] ),
+ $image_html
+ );
+ }
+ }
+ }
+ break;
+
case 'quote':
if ( ! empty( $meta['quote'] ) && ! stristr( $content, $meta['quote'] ) ) {
$quote = sprintf( '
%s', wpautop( $meta['quote'] ) ); if ( ! empty( $meta['quote_source'] ) ) { - $source = ( empty( $quote_meta['url'] ) ) ? $meta['quote_source'] : sprintf( '%s', esc_url( $meta['url'] ), $meta['quote_source'] ); + $source = ( empty( $meta['url'] ) ) ? $meta['quote_source'] : sprintf( '%s', esc_url( $meta['url'] ), $meta['quote_source'] ); $quote .= sprintf( '