在自定义媒体框架中添加附件显示设置


Adding Attachment Display Settings in custom media frame

我制作了自己的自定义媒体框架:

$('.add').bind('click', function(event) {
    event.preventDefault();
    // Create the media frame.
    file_frame = wp.media.frames.file_frame = wp.media({
        title: 'Select image to insert',
        button: {
            text: 'Insert',
        },
        multiple: true 
    });
    file_frame.open();
});

可以正常打开媒体管理器,但是缺少附件显示设置部分。我怎么才能得到呢?

在title下,您需要添加frame: 'post',在回调中,您应该使用frame.on('insert')而不是frame.on('select')