【发布时间】:2013-01-06 22:44:59
【问题描述】:
我对新 WordPress 3.5 中的媒体上传器没有什么问题。我创建了自己的插件来上传图片。我正在使用这段代码 JS:
<script type="text/javascript">
var file_frame;
jQuery('.button-secondary').live('click', function( event ){
event.preventDefault();
if ( file_frame ) {
file_frame.open();
return;
}
file_frame = wp.media.frames.file_frame = wp.media(
{
title: 'Select File',
button: {
text: jQuery( this ).data( 'uploader_button_text' )
},
multiple: false
}
);
file_frame.on('select', function() {
attachment = file_frame.state().get('selection').first().toJSON();
jQuery('#IMGsrc').val(attachment.url);
});
file_frame.open();
});
</script>
代码运行良好,但不幸的是表单似乎不完整。当我选择任何图片时,右侧不会显示“附件显示设置”。我不知道为什么。我尝试向媒体添加选项:
displaySettings: true,
displayUserSettings: true
但它也不起作用。
【问题讨论】:
-
你有没有想过这个问题?我正在尝试做同样的事情,所有的研究都显示了同样的事情,但没有人解释任何关于显示附件设置选项的内容......提前致谢。
-
也许你可以在这里找到解决方案stackoverflow.com/questions/21540951/…
标签: forms wordpress media uploader