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

Modal opens all post IDs

So your script is doing exactly what you have told it to do. Here you are passing the element to the function, but you never use it, instead you just query all elements with a class and add another class. function moreinfoModal(field) { console.log(field.id); $(‘.moreinfo-modal’).toggleClass(‘open’); } What you should do is only add the class … Read more