echo (int) $theme_width;
?>"<?php if ( 'video' === $safe_type ):
echo ' height="', (int) $theme_height, '"';
+ else:
+ echo ' style="visibility: hidden"';
endif; ?>></<?php echo $safe_type ?>>
<div class="wp-playlist-next"></div>
<div class="wp-playlist-prev"></div>
'loop' => $loop,
'autoplay' => $autoplay,
'preload' => $preload,
- 'style' => 'width: 100%',
+ 'style' => 'width: 100%; visibility: hidden;',
);
// These ones should just be omitted altogether if they are blank
if ( did_action( 'wp_enqueue_media' ) )
return;
- global $content_width;
+ global $content_width, $wpdb;
$defaults = array(
'post' => null,
}
}
- $audio = $video = 0;
- $counts = (array) wp_count_attachments();
- foreach ( $counts as $mime => $total ) {
- if ( 0 === strpos( $mime, 'audio/' ) ) {
- $audio += (int) $total;
- } elseif ( 0 === strpos( $mime, 'video/' ) ) {
- $video += (int) $total;
- }
- }
+ $has_audio = $wpdb->get_var( "
+ SELECT ID
+ FROM $wpdb->posts
+ WHERE post_type = 'attachment'
+ AND post_mime_type LIKE 'audio%'
+ LIMIT 1
+ " );
+ $has_video = $wpdb->get_var( "
+ SELECT ID
+ FROM $wpdb->posts
+ WHERE post_type = 'attachment'
+ AND post_mime_type LIKE 'video%'
+ LIMIT 1
+ " );
$settings = array(
'tabs' => $tabs,
),
'defaultProps' => $props,
'attachmentCounts' => array(
- 'audio' => $audio,
- 'video' => $video
+ 'audio' => (int) $has_audio,
+ 'video' => (int) $has_video,
),
'embedExts' => $exts,
'embedMimes' => $ext_mimes,
'videoReplaceTitle' => __( 'Replace Video' ),
'videoAddSourceTitle' => __( 'Add Video Source' ),
'videoDetailsCancel' => __( 'Cancel Edit' ),
- 'videoSelectPosterImageTitle' => _( 'Select Poster Image' ),
+ 'videoSelectPosterImageTitle' => __( 'Select Poster Image' ),
'videoAddTrackTitle' => __( 'Add Subtitles' ),
// Playlist