Do not use the alternative if/elseif/else syntax in `prepend_attachment()` introduced in [27622], as per kovshenin.
Fixes #27243. Built from https://develop.svn.wordpress.org/trunk@27682 git-svn-id: http://core.svn.wordpress.org/trunk@27523 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f20dbd9c68
commit
8bc15ab4fc
|
@ -1446,12 +1446,12 @@ function prepend_attachment($content) {
|
||||||
if ( empty($post->post_type) || $post->post_type != 'attachment' )
|
if ( empty($post->post_type) || $post->post_type != 'attachment' )
|
||||||
return $content;
|
return $content;
|
||||||
|
|
||||||
if ( wp_attachment_is_image() ):
|
if ( wp_attachment_is_image() ) {
|
||||||
$p = '<p class="attachment">';
|
$p = '<p class="attachment">';
|
||||||
// show the medium sized image representation of the attachment if available, and link to the raw file
|
// show the medium sized image representation of the attachment if available, and link to the raw file
|
||||||
$p .= wp_get_attachment_link(0, 'medium', false);
|
$p .= wp_get_attachment_link(0, 'medium', false);
|
||||||
$p .= '</p>';
|
$p .= '</p>';
|
||||||
elseif ( 0 === strpos( $post->post_mime_type, 'video' ) ):
|
} elseif ( 0 === strpos( $post->post_mime_type, 'video' ) ) {
|
||||||
$meta = wp_get_attachment_metadata( get_the_ID() );
|
$meta = wp_get_attachment_metadata( get_the_ID() );
|
||||||
$atts = array( 'src' => wp_get_attachment_url() );
|
$atts = array( 'src' => wp_get_attachment_url() );
|
||||||
if ( ! empty( $meta['width'] ) && ! empty( $meta['height'] ) ) {
|
if ( ! empty( $meta['width'] ) && ! empty( $meta['height'] ) ) {
|
||||||
|
@ -1459,9 +1459,9 @@ function prepend_attachment($content) {
|
||||||
$atts['height'] = (int) $meta['height'];
|
$atts['height'] = (int) $meta['height'];
|
||||||
}
|
}
|
||||||
$p = wp_video_shortcode( $atts );
|
$p = wp_video_shortcode( $atts );
|
||||||
elseif ( 0 === strpos( $post->post_mime_type, 'audio' ) ):
|
} elseif ( 0 === strpos( $post->post_mime_type, 'audio' ) ) {
|
||||||
$p = wp_audio_shortcode( array( 'src' => wp_get_attachment_url() ) );
|
$p = wp_audio_shortcode( array( 'src' => wp_get_attachment_url() ) );
|
||||||
endif;
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter the attachment markup to be prepended to the post content.
|
* Filter the attachment markup to be prepended to the post content.
|
||||||
|
|
Loading…
Reference in New Issue