这不是一个选项卡,但您可以通过一个上载按钮开始。退房pre-upload-ui
以及接下来的一些行动。即pre-plupload-upload-ui
和post-upload-ui
.
这将在\'Upload Files\' 制表符和收件人\'Media > Add New\'.
一零
add_action( \'pre-plupload-upload-ui\', \'wpse_20160202_pre_plupload_upload_ui\' );
add_action( \'post-upload-ui\', \'wpse_20160202_post_upload_ui\' );
function wpse_20160202_pre_plupload_upload_ui()
{
# see https://core.trac.wordpress.org/browser/tags/4.4.1/src/wp-admin/includes/media.php#L1902
print \'<button onclick="javascript:alert(\\\'Upload From Dropbox\\\');" id="db-upload-btn" class="button media-button button-primary button-large" style="margin-bottom:10px;">Upload From Dropbox</button>\';
}
function wpse_20160202_post_upload_ui()
{
# see wp-includes/media-template.php
print \'<button onclick="javascript:alert(\\\'Another Upload From Dropbox\\\');" id="db-upload-btn" class="button media-button button-primary button-large" style="margin-bottom:10px;">Another Upload From Dropbox</button>\';
}
TABS
将此添加到此处只是为了显示备用项。media_upload_tabs
将帮助您控制侧边和media_upload_{tab}
要呈现内容,请使用wp_iframe()
.add_filter( \'media_upload_tabs\', \'media_upload_tabs__tab_slug\' );
function media_upload_tabs__tab_slug( $tabs ) {
$newtab = array ( \'tab_slug\' => \'Your Tab Name\' );
return array_merge( $tabs, $newtab );
}
add_action( \'media_upload_tab_slug\', \'media_upload_tab_slug__content\' );
function media_upload_tab_slug__content() {
wp_iframe( \'media_upload_tab_slug_content__iframe\' );
}
function media_upload_tab_slug_content__iframe() {
?>
<div>tab_slug: Add your content here.</div><?php
}