Only displaying zip files with wp media
The zip files are in a subtype called application so you should try using: type: ‘application/zip’ A list of default allowed mime types is available from wp_get_mime_types.
The zip files are in a subtype called application so you should try using: type: ‘application/zip’ A list of default allowed mime types is available from wp_get_mime_types.
As of 4.1.1, the nonce is defined in wp-includes/media.php, line 2883: $settings[‘post’] = array( ‘id’ => $post->ID, ‘nonce’ => wp_create_nonce( ‘update-post_’ . $post->ID ), ); So to verify the nonce: wp_verify_nonce( $nonce, “update-post_$post_ID” );
This can be done using a front-end developer’s skills. What i achieved through the customization is as follows. Through the following code: <?php add_thickbox(); ?> <div id=”my-content-id” style=”display:none;”> <link rel=”stylesheet” href=”https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css”> <script src=”https://code.jquery.com/jquery-1.10.2.js”></script> <script src=”https://code.jquery.com/ui/1.11.4/jquery-ui.js”></script> <script> $(function() { $( “#tabs” ).tabs(); }); </script> <div id=”tabs” style=””> <ul> <li><a href=”#tabs-1″>Insert Edit/link</a></li> <li><a href=”#tabs-2″>My Second Tab</a></li> </ul> … Read more
After reading up on the Backbone.js documentation I found out it’s quite easy to manually add attachments by ID to the library of the media frame. You can just assign a reference to the library on the open event. Then create an instance of wp.media.attachment. Fetch it. And then call the add function on your … Read more
This block of code will add a button right next to the “Insert into post” one. When clicked, it will send selected images to WP editor, each wrapped inside your template HTML: var wpMediaFramePost = wp.media.view.MediaFrame.Post; wp.media.view.MediaFrame.Post = wpMediaFramePost.extend( { mainInsertToolbar: function( view ) { “use strict”; wpMediaFramePost.prototype.mainInsertToolbar.call(this, view); var controller = this; this.selectionStatusToolbar( view … Read more
Edit single attachment on click (WP-admin)
Add guid filter to attachment in media library grid mode
Perform a custom (bulk) action in media view
I think I got it , if (wp.media) { wp.media.view.Modal.prototype.on(‘open’, function(data) { console.log(wp.media.frame.modal.clickedOpenerEl); }); } let me know if there is better solution.
To use a custom control, you need a field with special attributes to be linked to the “publish” button. if you don’t want to display this field, you can generate a hidden field like that : class WP_Test_2_Customize_Control extends WP_Customize_Control { public function render_content() { ?> <input id=”<?php echo htmlspecialchars(“_customize-input-{$this->id}”);?>” type=”hidden” <?php $this->input_attrs();?> <?php if … Read more