diff --git wp-includes/media.php wp-includes/media.php
index 09e0630..42a9825 100644
|
|
function get_the_post_format_image( $attached_size = 'full', &$post = null ) { |
2428 | 2428 | // wrap image in <a> |
2429 | 2429 | if ( ! empty( $meta['url'] ) ) |
2430 | 2430 | $image = sprint( $link_fmt, $image ); |
2431 | | } elseif ( has_shortcode( $meta['image'], 'gallery' ) ) { |
| 2431 | } elseif ( has_shortcode( $meta['image'], 'caption' ) ) { |
2432 | 2432 | // wrap <img> in <a> |
2433 | 2433 | if ( ! empty( $meta['url'] ) && false === strpos( $meta['image'], '<a ' ) ) { |
2434 | 2434 | $meta['image'] = preg_replace( |
diff --git wp-includes/post-formats.php wp-includes/post-formats.php
index b993183..392f8aa 100644
|
|
function post_formats_compat( $content, $id = 0 ) { |
374 | 374 | |
375 | 375 | case 'image': |
376 | 376 | if ( ! empty( $meta['image'] ) ) { |
377 | | $image = is_numeric( $meta['image'] ) ? wp_get_attachment_url( $meta['image'] ) : $meta['image']; |
378 | 377 | |
379 | | if ( ! empty( $image ) && ! stristr( $content, $image ) ) { |
380 | | if ( false === strpos( $image, '<a ' ) ) { |
381 | | $image_html = sprintf( |
| 378 | if ( has_shortcode( $meta['image'], 'caption' ) ) { |
| 379 | // wrap <img> in <a> |
| 380 | if ( ! empty( $meta['url'] ) && false === strpos( $meta['image'], '<a ' ) ) { |
| 381 | $meta['image'] = preg_replace( |
| 382 | '#(<img[^>]+>)#', |
| 383 | sprintf( '<a href="%s">$1</a>', esc_url( $meta['url'] ) ), |
| 384 | $meta['image'] |
| 385 | ); |
| 386 | } |
| 387 | $format_output .= do_shortcode( $meta['image'] ); |
| 388 | } else { |
| 389 | |
| 390 | if ( is_numeric( $meta['image'] ) ) { |
| 391 | $image = wp_get_attachment_image( absint( $meta['image'] ), 'full' ); |
| 392 | } elseif ( ! preg_match( '#<[^>]+>#', $meta['image'] ) ) { |
| 393 | // not HTML, assume URL |
| 394 | $image = sprintf( |
382 | 395 | '<img %ssrc="%s" alt="" />', |
383 | 396 | empty( $compat['image_class'] ) ? '' : sprintf( 'class="%s" ', esc_attr( $compat['image_class'] ) ), |
384 | | $image |
| 397 | esc_url( $meta['image'] ) |
385 | 398 | ); |
386 | 399 | } else { |
387 | | $image_html = $image; |
| 400 | // assume HTML |
| 401 | $image = $meta['image']; |
388 | 402 | } |
389 | 403 | |
390 | | if ( empty( $meta['url'] ) || false !== strpos( $image, '<a ' ) ) { |
391 | | $format_output .= $image_html; |
392 | | } else { |
| 404 | if ( ! empty( $meta['url'] ) && false === strpos( $image, '<a ' ) ) { |
393 | 405 | $format_output .= sprintf( |
394 | 406 | '<a href="%s">%s</a>', |
395 | 407 | esc_url( $meta['url'] ), |
396 | | $image_html |
| 408 | $image |
397 | 409 | ); |
| 410 | } else { |
| 411 | $format_output .= $image; |
398 | 412 | } |
399 | 413 | } |
400 | 414 | } |