2
我有问题了解如何实现新的WP媒体上传器到我的主题选项页面。是否有关于如何做到这一点的文档或什么是如此的解释?我已经看到了一些如何做到这一点的示例,但没有一个关于它们的代码有任何好的解释。是否有选项列表如何自定义媒体上传框架?我的意思是,那岂不是很好,如果你可以做这样的事情(见//创建媒体框架):3.5 Wordpress媒体上传器手动执行
// Uploading files
var file_frame;
jQuery('.upload_image_button').live('click', function() {
// If the media frame already exists, reopen it.
if (file_frame) {
file_frame.open();
return;
}
// Create the media frame.
file_frame = wp.media.frames.file_frame = wp.media({
title: 'My frame title',
button: {
text: 'My button text',
},
id: 'logo-frame',
multiple: false,
editing_sidebar: false, // Just added for example
default_tab: 'upload', // Just added for example
tabs: 'upload, library', // Just added for example
returned_image_size: 'thumbnail' // Just added for example
});
// When an image is selected, run a callback.
file_frame.on('select', function() {
var attachment;
// We set multiple to false so only get one image from the uploader
attachment = file_frame.state().get('selection').first().toJSON();
// Do something with attachment.id and/or attachment.url here
});
// Finally, open the modal
file_frame.open();
return false
});
嗨,你会知道为什么这行不起作用?作者:userSettings.uid - 画廊不断显示所有照片。谢谢! – jinggoy