Remove the ‘Attachment Details’ section of the wordpress media manager

Question

I’m using the new WP media manager for a branding plugin (well, new from 3.5), and it is working well.

My only issue is that I have an ‘Attachment Details’ area on the right, allowing users to edit, delete and generally mess with images.

Is there a way to remove this area? Thanks.

Here is an image showing which area I want to eliminate –
enter image description here

Here is my JS to invoke the media manager –

$(document).ready(function(){

    var dd_media_frame,     // The custom dd_media frame
        clicked_parent = 0; // The parent element of the button that was clicked

    /** Open the media manager when the any button with the class 'open-media-manager' is clicked*/
    $('#dd-custom-branding-metabox').on('click', '.manage-images-button', function(e){

        e.preventDefault();

        clicked_parent = $(this).parent();

        /** Ensure the 'dd_media_frame' media manager instance already exists (i.e. if it's already been used since the page was loaded) */
        if(!dd_media_frame){

            dd_media_frame = wp.media.frames.dd_media_frame = wp.media({

                /** Set the parameters for the media uploader */
                button: { text: 'Select image' },                           // Set the text of the button.
                className: 'media-frame custom-admin-branding-media-frame', // The class to use for this instance of the media manager
                library: { type: 'image' },                                 // Ensure only images are allowed
                multiple: false,                                            // Disable multiple selections
                title: 'Select a custom admin header image'                 // The tile to show in the media uploader
            });

            dd_media_frame.on('select', function(){

                /** Grab the attachment selection and construct a JSON representation of the model */
                var media_attachment = dd_media_frame.state().get('selection').first().toJSON();

                /** Update the hidden 'branding[header_logo]' field with the ID of the selected logo */
                clicked_parent.find('input[name="branding[header_logo]"]', '#dd-custom-branding-metabox').val(media_attachment.id);

            });

        }

        /** Finally, open the media manager */
        dd_media_frame.open();

    });

});
0
David Gard 5 months 2020-12-17T05:10:24-05:00 0 Answers 7 views 0

Leave an answer

Browse
Browse