1

Let's cut to the chase:

popup = wp.media({
    frame: 'post',
    state: 'insert',
    library: {
        type: [ 'image' ]
    },
    multiple: false
});

There is a list of arguments I use when opening wp.media popup above. It works great but I'd like to hide the popup's left hand side menu (the one which allows you to select either image insert or gallery insert) and right hand side media details sidebar (the one with all selected media file details). Are there any arguments to be passed to wp.media which could help to achieve that or shall I rather use popup.on( 'open', function() {...}); instead?

Cheers, Dan.

1

Ok, It's been so long since I posted this question I totally forgot about it. I finally used popup.on( 'open', function() {...}); to remove left modal sidebar. Here we go:

popup.on( 'open', function() {

    jQuery( '.media-frame-menu' ).remove();
    jQuery( '.media-frame-router, .media-frame-title, .media-frame-content, .media-frame-toolbar' ).css({'left': 0});

});

That's it :)

EDIT

I managed to hide right hand side image detail sidebar of the media modal as well but it required adding admin CSS. jQuery (add to above function as third line below two others):

jQuery( '.media-modal-content' ).addClass( 'full-width' );

And then in admin style CSS file:

.media-modal-content.full-width .media-frame-content .attachments-browser .media-toolbar,
.media-modal-content.full-width .media-frame-content .attachments-browser .attachments {
    right: 0 !important;
}

.media-modal-content.full-width .media-frame-content .attachments-browser .media-sidebar {
    display: none !important;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.