Wordpress

时间:2015-10-08 10:57:04

标签: jquery wordpress

我有自定义帖子类型,其自定义图片字段是使用元框创建的。

当我上传图片时,WordPress的媒体上传窗口会正确显示,我可以上传新图片。

问题在于我想要放置媒体库的图像,因为媒体库的图像没有加载。

我用来加载媒体上传器的code是下一个:



<script type="text/javascript">
jQuery(document).ready(function() {
  jQuery(".boton-imagen-caja").click(function() {
    formfieldID = jQuery(this).prev().attr("id");
    formfield = jQuery('#' + formfieldID).attr('name');
    tb_show('', 'media-upload.php?type=image&TB_iframe=true');
    return false;
  });
  var restore_send_to_editor = window.send_to_editor;
  window.send_to_editor = function(html) {
    var imgurl = jQuery('img',html).attr('src');
    jQuery('#' + formfieldID).val(imgurl);

    tb_remove(); 
    window.send_to_editor = restore_send_to_editor;
  }
});
</script>
&#13;
&#13;
&#13;

我列出了问题的截图:

Screenshot of the media upload window where the media library images aren't loaded

0 个答案:

没有答案