diff --git a/src/wp-content/themes/twentyeleven/style.css b/src/wp-content/themes/twentyeleven/style.css index 7c9cb3ce96..4df95c5257 100644 --- a/src/wp-content/themes/twentyeleven/style.css +++ b/src/wp-content/themes/twentyeleven/style.css @@ -1706,6 +1706,18 @@ section.recent-posts .other-recent-posts li:after { text-transform: uppercase; } +/* =Media +-------------------------------------------------------------- */ + +audio, +video { + display: inline-block; + max-width: 100%; +} + +.attachment .entry-content .mejs-container { + margin-bottom: 24px; +} /* =Navigation -------------------------------------------------------------- */ diff --git a/src/wp-content/themes/twentythirteen/style.css b/src/wp-content/themes/twentythirteen/style.css index 975d68083d..a78cb9a0d0 100644 --- a/src/wp-content/themes/twentythirteen/style.css +++ b/src/wp-content/themes/twentythirteen/style.css @@ -1837,6 +1837,18 @@ footer.entry-meta { display: none; } +.attachment .entry-content .mejs-audio { + max-width: 400px; + margin: 0 auto; +} + +.attachment .entry-content .wp-video { + margin: 0 auto; +} + +.attachment .entry-content .mejs-container { + margin-bottom: 24px; +} /** * 5.7 Post/Paging Navigation diff --git a/src/wp-content/themes/twentytwelve/style.css b/src/wp-content/themes/twentytwelve/style.css index 7fb30fff08..93cd07fd5c 100644 --- a/src/wp-content/themes/twentytwelve/style.css +++ b/src/wp-content/themes/twentytwelve/style.css @@ -1007,6 +1007,17 @@ footer.entry-meta { margin-top: 1.571428571rem; } +/* =Single audio/video attachment view +-------------------------------------------------------------- */ + +.attachment .entry-content .mejs-audio { + max-width: 400px; +} + +.attachment .entry-content .mejs-container { + margin-bottom: 24px; +} + /* =Single image attachment view -------------------------------------------------------------- */ diff --git a/src/wp-includes/post-template.php b/src/wp-includes/post-template.php index fcc75f934e..c078b8a6df 100644 --- a/src/wp-includes/post-template.php +++ b/src/wp-includes/post-template.php @@ -347,7 +347,7 @@ function get_post_class( $class = '', $post_id = null ) { if ( post_password_required( $post->ID ) ) { $classes[] = 'post-password-required'; // Post thumbnails - } elseif ( current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail( $post->ID ) ) { + } elseif ( ! is_attachment( $post ) && current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail( $post->ID ) ) { $classes[] = 'has-post-thumbnail'; } @@ -1241,10 +1241,23 @@ function prepend_attachment($content) { if ( empty($post->post_type) || $post->post_type != 'attachment' ) return $content; - $p = '
'; + if ( wp_attachment_is_image() ): + $p = ''; + elseif ( 0 === strpos( $post->post_mime_type, 'video' ) ): + $meta = wp_get_attachment_metadata( get_the_ID() ); + $atts = array( 'src' => wp_get_attachment_url() ); + if ( ! empty( $meta['width'] ) && ! empty( $meta['height'] ) ) { + $atts['width'] = (int) $meta['width']; + $atts['height'] = (int) $meta['height']; + } + $p = wp_video_shortcode( $atts ); + elseif ( 0 === strpos( $post->post_mime_type, 'audio' ) ): + $p = wp_audio_shortcode( array( 'src' => wp_get_attachment_url() ) ); + endif; + $p = apply_filters('prepend_attachment', $p); return "$p\n$content";