Questions tagged [media-modal]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
30 votes
2 answers
6k views

Enhance Media Manager for Gallery

I would like to enhance the Media Editor, after WordPress 3.5, on the gallery view. I want to add a new select field on the right side and send the selected values to the gallery shortcode. I think, ...
bueltge's user avatar
  • 17k
25 votes
4 answers
4k views

Trigger refresh for new media manager in 3.5

I'm trying to figure out how it's possible to 'refresh' the media library in the new media dialogue in 3.5. I'm adding images from an external image library to the WordPress library (via a tab/iFrame ...
Richard Sweeney's user avatar
15 votes
2 answers
3k views

Delete an attachment in the WP media modal window

I'm trying to create an option in the WP modal media window to detect duplicate files and delete a newer file if an older duplicate is found. I have the following code working (in conjunction with the ...
bcorkins's user avatar
  • 505
14 votes
1 answer
2k views

Using the WordPress 3.5 Media Uploader window as a modal popup

I have a general question: is it possible to use the new WordPress 3.5 Media Uploader window for other purposes (i.e., as a modal popup window for content)? I would like to do this and have spent a ...
Dworsf01's user avatar
  • 141
13 votes
1 answer
5k views

Add filter function in media modal box

I'm trying to extend the media modal, but I cant' find any documentation / tutorials about it. I'm not a master of backbone too ;-) I want to add a select box for each taxonomy that is attached to ...
Horttcore's user avatar
  • 1,113
12 votes
2 answers
3k views

How to trigger a refresh in the media modal

I'm developing a plugin that adds a new tab to the media modal, and I need to know a way trigger a refresh of the attachments tab so it shows newly added attachments. This is the code I'm using: wp....
leemon's user avatar
  • 1,806
11 votes
2 answers
4k views

List of available events for wp.media

Is there a list of available events for wp.media object? By doing some googling, I managed to find following events: for wp.media.view.Modal.prototype: open, ready - they are triggered, when user ...
Kārlis Baumanis's user avatar
9 votes
2 answers
2k views

ThickBox replacement

I'm searching, unsuccessfully unfortunately, for a ThickBox replacement used in Media Uploader. Any search fails on how to leverage Media Uploader and nothing about a script used for modal windows. ...
Domagoj's user avatar
  • 155
8 votes
5 answers
5k views

Wordpress 3.5 Media Manager - add a button

In my plugin, I would like to add two buttons to Media Manager (to the left of "Insert Into Post" in "media-toolbar-primary" section), and connect a jQuery action to it. First one - The "Select All" ...
Marcin Bobowski's user avatar
8 votes
1 answer
3k views

Rendering the uploaded file in a wp.media object

I have seen this question asked a few times on SO and I don't see any responses. I have a wp.media object (upload dialog), that I am using in to store an upload to a post as a meta element. It works ...
setterGetter's user avatar
8 votes
3 answers
3k views

Adding custom input for data attribute in insert media modal

I'm trying to add a text input to the "Insert Media" modal in the hopes of being able to add an html5 data- attribute to the images' parent anchor. <a class="fancybox" href="..." data-fancybox-...
apaul's user avatar
  • 133
7 votes
1 answer
884 views

Best approach when modifying the Media Manager

I am trying to edit the Media Manager to allow the selection of a new option in the "Link to" select field. This Backbone template is currently defined in media-template.php <label class="...
Stewarty's user avatar
  • 312
7 votes
1 answer
1k views

Custom "Uploads" Dir: "Edit Image" in Media Library broken

Directory Structure I have customized my (local) install (dev box). The current directory structure is: ./root |- wp (WordPress Core root) \ |- wp-config.php |- wp-content (Content and ...
kaiser's user avatar
  • 50.5k
6 votes
1 answer
1k views

Bind event on Media gallery elements WordPress

Good day ! Please help to get binding on WordPress Media Upload elements. When i click on any of gallery item need a custom function to fire up. There is a BackBone collection called "Attachment" ...
Vladimir Lukyanov's user avatar
6 votes
1 answer
1k views

Customizing the 3.5 "Add Media" popup (Backbone.js)

Here's yet another question in regard to the new(ish) 3.5 "Add Media" popup and how to customize it! What I'm trying to do I'm attempting to do four main things: 1) Create a custom tab titled "...
Designer 17's user avatar
5 votes
2 answers
6k views

How to restrict images in v3.5 Media Library modal to only those from a specific post id?

How can someone restrict the images which appear in the v3.5 Media Library modal to only show those that are attached to a specific post id? I'm creating a front-end management template that allows ...
MTT's user avatar
  • 3,526
5 votes
2 answers
8k views

Is it possible to trigger some JavaScript when Media Popup is opened?

On one of my custom posts edit page I have a button that triggers the media popup onclick, with: wp.media.editor.open(); and while it brings up the media manager I'm not sure if that's the proper way ...
jayarjo's user avatar
  • 498
5 votes
2 answers
2k views

Expanding new Media Uploader in WordPress 3.5

In current version of WordPress it is quite easy to expand the attachments fields using attachment_fields_to_edit filter, but in latest WordPress 3.5 RC2 it's not working. We can expand it using ...
rzepak's user avatar
  • 88
5 votes
1 answer
2k views

Filter media library items by size

I want to prevent users from being able to set a Featured Image from the media library if its width is less than 100px. Originally I thought to use the ajax_query_attachments_args filter, but it ...
cfx's user avatar
  • 1,491
5 votes
1 answer
3k views

Modifying the media-template.php file, the right way?

The [gallery] shortcode accepts the columns='0' as an attribute so that it doesn't insert any breaks in the HTML between gallery items, however this option is not available in Gallery Settings ...
Michael Ruta's user avatar
4 votes
3 answers
7k views

Disable media library tab for non admins in uploader screen

I am developing a plugin in which i am required to allow front end users to upload media, which I am able to do. But I don't want to let them sneak into media library which comes as tab with uploader ...
Prince Singh's user avatar
4 votes
1 answer
2k views

Using Underscore Templates in WordPress

I've noticed that since WP 3.5 that we now have the Backbone.js and Underscore.js libraries included. The new Media Modal uses Underscore templates and I was wondering how would I be able to insert ...
Manny Fleurmond's user avatar
4 votes
1 answer
3k views

Refresh wp.media after ajax call

I'm building a plugin where I add a tab to the media manager and can add stuff from another source. I add the tab with this, which generates a iframe: add_filter('media_upload_tabs', '...
gubbfett's user avatar
  • 315
4 votes
1 answer
875 views

'Add Media' button doesn't work when editor is initialized from javascript

I am trying to instantiate the wp_editor with javascript, which works nicely except the 'Add Media' button does not work. There are no errors, but clicking the button does nothing. The simplest test ...
Jesse Norell's user avatar
4 votes
1 answer
267 views

Add control in image detail panel

I am trying to add a checkbox control in the image details popup (when editing image in a post). I have added the following code in my template function.php but I can't manage to display the checkbox ...
Mika A.'s user avatar
  • 141
4 votes
2 answers
3k views

Hook for image edit popup

Is there a hook for the popup window which shows up when you click on the edit button on an image in a post?
Stephan S.'s user avatar
3 votes
1 answer
23k views

How do I add the data-toggle="modal" data-target="#myModal" attribures to a WP Nav bar?

I'm new to Wordpress so please be patient! I've created a template in html5/ccs3 and am in the process of trying to make a wordpress template out of it. In my navigation menu (in html) I have a ...
Benn Moffat's user avatar
3 votes
1 answer
781 views

What type of template are WP media-modal's templates?

I was looking at the Wordpress templates (html that's written to the page instead of awkwardly adding strings in JS). There are a lot of templates like this in a post editor for example: <script ...
NoBugs's user avatar
  • 432
3 votes
2 answers
2k views

Wp3.5 Media Gallery Edit modal: change captions to title

How can i change those editing inputs to title from caption? Some sources i found about new upload system: Using the WordPress 3.5 Media Uploader within plugins How to Add the WordPress 3.5 Media ...
Ünsal Korkmaz's user avatar
3 votes
1 answer
1k views

Modify Custom Field in Media Library using JavaScript

I've added a custom field into my media attachments: function set_image_data( $form_fields, $post ) { $form_fields['text_color'] = array( 'label' => 'Text Color', 'input' =>...
Howdy_McGee's user avatar
  • 20.5k
3 votes
1 answer
1k views

Modify the array of selected images in media modal

I'm creating a plugin which checks for duplicate media items on upload. If a file is uploaded, and it already exists in the media library, I'm presenting the user with the option to delete the ...
bcorkins's user avatar
  • 505
3 votes
1 answer
2k views

Media manager multiple selection

I was creating a plugin, and its part should by adding files to custom posts. I managed script to work, but after few changes, to better look and function, it allows only one file to be added, than no ...
sjiamnocna's user avatar
3 votes
1 answer
1k views

Restrict file types in the uploader of a wp.media frame

When creating a wp.media frame in JS, is it possible to specify allowed file types for the uploads tab? wp.media({ title: 'Pick a PDF', button: { text: 'Use this file...' }, ...
ax1mx2's user avatar
  • 131
3 votes
0 answers
137 views

Media modal in IE9 not working when included from plugin with wp admin scripts minified

This issue occurs with custom code that uses the WP Media modal, such as https://github.com/humanmade/Custom-Meta-Boxes or https://wordpress.org/plugins/categories-images/ The modal window does not ...
paul's user avatar
  • 338
3 votes
0 answers
187 views

Category checkboxes in upload modal

In a project I'm working on, I've enabled categories for attachments using: register_taxonomy_for_object_type('category', 'attachment'); In the edit attachment screen in the Media Library you see ...
leemon's user avatar
  • 1,806
2 votes
1 answer
1k views

Run script after clicking Set Featured Image in Media

I would like to run some script to get the featured image's width and height after the user clicked 'Use Featured Image' button and use the data retrieved within the Post Edit screen. Is there such ...
Billy's user avatar
  • 249
2 votes
1 answer
6k views

Upload images from custom plugin using the media modal

I'm creating a custom plugin and I need users to be able to upload multiple images. I want them to be able to do this through the built-in media page but through a modal/pop up from the plugins ...
Brandon Benefield's user avatar
2 votes
1 answer
3k views

How to set additional parameter in wp.media?

I have this code. $('.custom-browse-button').on('click', function(e) { e.preventDefault(); var wpMedia = wp.media.frames.file_frame = wp.media({ 'library': { type: 'image'...
vee's user avatar
  • 231
2 votes
1 answer
458 views

Adding fields to the media uploader with jquery listeners

So I have the code to successfully add a select field to my media uploader (gallery view) which is cool, but I also need to add some jquery listeners to that field. I'm using the '...
rugbert's user avatar
  • 168
2 votes
2 answers
2k views

How to extend Media Library (WP 4.4)

I am trying to implement a new tab next to Media Library. I couldn't find solution to implement this. I found an example how to implement a new tab in this link: https://gist.github.com/Fab1en/4586865 ...
minnur's user avatar
  • 123
2 votes
1 answer
1k views

Is it possible to hide media details sidebar when wp.media popup is being opened?

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 ...
Daniel's user avatar
  • 181
2 votes
1 answer
267 views

Adding image to visual editor popup for shortcode with wp.media and wp.mce: changing image duplicates shortcode

tl;dr: Why does using media manager popup within a TinyMCE popup cause duplications of shortcodes? Is it my code or just the way life is? [Spoiler: It was my code] I've written a small plugin to ...
Andy Macaulay-Brook's user avatar
2 votes
1 answer
2k views

trigger('change') not working

I am using wp.media modal attachment API to import images to customizer. Along with the images, I have imported their meta data as well ( Title, Description, Alt Text etc.). These are in the form of ...
Divjot Singh's user avatar
2 votes
1 answer
662 views

Is there a native wp.media way to detect who "opened" wp.media.frame

I added few custom fields via attachment_fields_to_edit and would like to show them only when certain theme or page builder image option opens the wp.media.iframe. Currently they are visible ...
Benn's user avatar
  • 1,023
2 votes
1 answer
880 views

Filter medias from the Media Uploader (wp.media) modal with a post meta

I would like to have a media uploader modal that displays only image medias having a specific post meta, let's say 'my_image_meta'. How could I achieve this ? Here's my actual code, which just filters ...
gordie's user avatar
  • 482
2 votes
0 answers
190 views

Perform a custom (bulk) action in media view

I wish to figure out how to add a custom action button in the media grid view ( upload.php screen) and how to perform a custom (bulk) action to the selected attachments, as shown in the screenshot ...
Virgo's user avatar
  • 99
2 votes
0 answers
629 views

Add guid filter to attachment in media library grid mode

I'm trying to show in media modal box, attachments from a specific folder in my website and, correct me if I'm wrong, the best way to proceed is a like filter on wp_posts field GUID. Something like ...
user114036's user avatar
2 votes
0 answers
150 views

Edit single attachment on click (WP-admin)

I've created a custom media manager for a CPT I've created. I have everything functioning properly except an edit function. I want to have an edit button for each attachment that gets added to the ...
Austin Biggs's user avatar
1 vote
2 answers
3k views

Show selected images on top in Media Manager

I've searched numerous StackOverflow and Wordpress Awnsers questions, but I couldn't find any solution that matches my situation or even remotely points me in the right direction. I have a custom ...
Ogier Schelvis's user avatar
1 vote
2 answers
958 views

Change Media modal image size

When i create a page, and click "Add media" button above the TinyMCE editor, the Media Modal shows up. Question: How do i edit the size of the images showing in the modal? The current images are ...
Sillo's user avatar
  • 110