add mediaelement.js plugins into WordPress video player control bar

You can alter the mediaelement.js feature-set using the mejs_settings hook. Settings Overview Defaults are: playpause, current, progress, duration, tracks, volume, fullscreen. Add the plugin to the array as needed to extend the features. add_filter(‘mejs_settings’, function ($settings) { $settings[‘features’] = array(…,’jumpforward’); return $settings; }); Make sure to enqueue the plugin itself: wp_enqueue_script( ‘mejs-plugin-name’, ‘path_to_plugin_file’, array(‘wp-mediaelement’), null, … Read more

Audio file’s length (duration) is missing from Attachment Details in Media Library [closed]

I found that this issue could be overcome by opening the mp3 file in the excellent Linux/Windows application Mp3 Diags and applying the Rebuild VBR Data transformation. It discards the file’s Xing header and attaches a new one. After doing this, the files’s duration and bitrate are listed in it’s Attachment Details when it is … Read more

How to fetch only media that was already attached to a post/page?

A similar approach to your post_parent idea is to add a filter to posts_where: function bbg_filter_out_non_attachments( $sql ) { global $wpdb; // Maybe do some conditional logic to decide whether to filter this query, then… return $sql . ” AND $wpdb->posts.post_parent != 0 “; } add_filter( ‘posts_where’, ‘bbg_filter_out_non_attachments’ ); Another technique is to do a … Read more

Check if post has gallery images/media

No Need for SQL queries in the template. function wpse_72594_get_attachments( $id, $mime=”” ) { $args = array( ‘post_type’ => ‘attachment’, ‘post_mime_type’ => $mime, ‘post_parent’ => $id ); $attachments = get_posts($args); if ($attachments) return $attachments; return false; } Then call the function like this (300 is the post ID): wpse_72594_get_attachments(300), grabs all attachments wpse_72594_get_attachments(300, ‘image’ ), … Read more