dimanche 1 février 2015

Open Media Uploader Link in single post or page


I want to open the media Upload Window like in a single post or page. It is important for me, to have that menu on top, which filters the media Library:


enter image description here


This is my current code, which allows only to filter by date:



$('.tc_upload_img_btn').live('click', function( event ){
var parent_wrapper = $(this).parent('td').parent().parent().parent().parent();
var field = $(this).parent('td').parent('tr').find('input[type="text"]');
var button = $(this);
var multi = false;
var absolute_link = $(this).attr( 'data-allow-multi' );

if( $(this).attr( 'data-allow-multi' ) == "true" ){
multi = true;
}

var insertImage = wp.media.controller.Library.extend({
defaults : _.defaults({
id: 'insert-image',
frame: 'post',
title: 'Datei wählen',
allowLocalEdits: true,
displaySettings: true,
displayUserSettings: true,
multiple : true/*,
type : 'image'//audio, video, application/pdf, ... etc*/
}, wp.media.controller.Library.prototype.defaults )
});

var frame = wp.media({
button : { text : 'Select' },
frame: 'post',
state : 'insert-image',//gallery-edit
states : [
new insertImage()
],
library : { type : 'image'}
});

frame.open(button);
)}


Which param do I need to add, to get the other filter (red marked in the screen)?


Many Thanks!





Aucun commentaire:

Enregistrer un commentaire