在这个question 我已经找到了如何在图像上载程序中创建自定义选项卡。
代码如下:
add_filter(\'media_upload_tabs\', \'my_media_upload_tabs_filter\');
function my_media_upload_tabs_filter($tabs) {
unset($tabs["type_url"]);
unset($tabs[\'library\']);
$newtab = array(\'ell_insert_gmap_tab\' => __(\'Google Map\',\'insertgmap\'));
return array_merge($tabs,$newtab);
}
add_action(\'media_upload_ell_insert_gmap_tab\', \'media_upload_ell_gmap_tab\');
function media_upload_ell_gmap_tab() {
return wp_iframe(\'media_upload_ell_gmap_form\', $errors );
}
function media_upload_ell_gmap_form() {
?>
echo media_upload_header();
?>
<h2>HTML Form</h2>
<?php
}
现在,我想使用该选项卡的图像选择功能。因此,我将选项卡中的代码修改为: <form enctype="multipart/form-data" method="post" action="">
<h3 class="media-title">Choose Background:</h3>
Alternatively, you can choose one of these background images:<br/>
<img style="float:left; margin:15px; cursor:pointer" id="background-Green-stripes" src="<?php bloginfo(\'url\'); ?>/wp-content/themes/mytheme/images/background-Green-stripes-thumb.jpg">
<a class="button choice_button" style="float:left; display:block" id="image 1">choose this</a>
<img style="float:left; margin:15px; cursor:pointer" id="background-Pail-pink-squares.jpg" src="<?php bloginfo(\'url\'); ?>/wp-content/themes/mytheme/images/background-Pail-pink-squares-thumb.jpg">
<a class="button choice_button" style="float:left; display:block" id="image 2">choose this</a>
<img style="float:left; margin:15px; cursor:pointer" id="background-Purple-wall.jpg" src="<?php bloginfo(\'url\'); ?>/wp-content/themes/mytheme/images/background-Purple-wall-thumb.jpg">
<a class="button choice_button" style="float:left; display:block" id="image 3">choose this</a>
</form>
并试图从“window.send\\u to\\u editor”获取html,但不知道如何。。。有人能帮忙吗?我在这里迷路了。。。