Showing All Media from All Multisites

After posting the question, I did a ton of googles, and eventually built a plugin that displays all media for all subsites in a multisite installation. If the user is SuperAdmin, each picture is linked to it’s editing page. The plugin is called ‘Multiside Media Display’, and available via the usual Add Plugins page in … Read more

Hide download button from audio player

Hi another simple way is to add the following code to hide the download button. Please adapt width and margin top elements. .wp-block-audio:after { width:35px; background-color:#F1F3F4; color:#F1F3F4; content:’.’; float:right; border-radius:50%; margin-top:-95px; z-index:999; position:relative; }

How to share media between independent blogs?

I’m afraid you’ll also need to create the database records – that’s how WP looks for media files, starting in the db. Those records then tell WP the local path to the media file. But that means that if your web server has access to both sub domain folders on disk, you don’t need to … Read more

How to create different media uploader frames / filter library depending on a custom action

You will have to create two different media modals that are fired depending on your click event. Here is some code from a recent project where I added these buttons to the tinyMCE visual editor: jQuery(document).ready(function($){ $(document).on(‘click’, ‘.mce-my_upload_button’, upload_image_tinymce); $(document).on(‘click’, ‘.mce-my_upload_pdf_button’, upload_pdf_tinymce); function upload_image_tinymce(e) { e.preventDefault(); var $input_field = $(‘.mce-my_input_image’); var custom_uploader = wp.media.frames.file_frame = … Read more

Modify media file markup output

WordPress has a filter image_send_to_editor which lets you modify the html that is generated by the media editor. Usage: add_filter (‘image_send_to_editor’, ‘wpse264886_filter_image’, 10, 8); function wpse264886_filter_image ($html, $id, $caption, $title, $align, $url, $size, $alt) { $html=”<span> … </span>” . $html; return $html; } This will insert the spans always, however, not only when there is … Read more

WP_Custom_Media_Control | Give ID to media file

The setting associated with the media control will have the ID for the attachment stored as its value. Assuming you have registered a setting for your control like this: $wp_customize->add_setting( ‘resume’, array( ‘type’ => ‘option’, // … ) ); Then you would obtain the attachment ID just by reading from the option, like: get_option( ‘resume’ … Read more