Created
July 17, 2017 12:43
-
-
Save lgedeon/34ec75107085742a95f348affbc452e3 to your computer and use it in GitHub Desktop.
Experimental code (not yet working) to make items in the media library non-selectable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//wp.media.view.Modal.prototype: open, ready | |
( function ($) { | |
var $attachments = $('.attachments').children(), | |
blocked = [ 1, 2, 12, 4593 ]; | |
wp.media.events.on( 'open', function( arguments ) { | |
alert('event fired') | |
}); | |
$attachments.each( function(index) { | |
var $this = $(this), | |
id = $this.data("id"); | |
if ( -1 !== blocked.indexOf( id ) ) { | |
$this.children( '.js--select-attachment' ).removeClass( 'js--select-attachment' ); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment