关于优秀主题duotive-three主题后台上传功能失效的解决方法

2012/12/10

今天在调试duotive-three这个主题的时候,发现上传功能实现,只显示黑色,不能出现上传对话框。测试了多个版本,从1.1到1.51,都有这种问题。我不知道大家使用这个主题有没有遇到类似的问题。当然你直接粘贴地址是可以的。但是这样不方便。于是只能需求解决方法。通过检视源码,发现主题上传功能出现在duotive-main.php这个文件里。存在如下的代码:

jQuery(‘#headerlogo_button’).click(function() {
formfield = jQuery(‘#headerlogo’).attr(‘name’);
tb_show(”, ‘media-upload.php?type=image&TB_iframe=true’);
destination = ‘add-logo’;
return false;
});
jQuery(‘#favicon_button’).click(function() {
formfield = jQuery(‘#favicon’).attr(‘name’);
tb_show(”, ‘media-upload.php?type=image&TB_iframe=true’);
destination = ‘add-favicon’;
return false;
});
window.send_to_editor = function(html) {
switch(destination)
{
case ‘add-favicon’:
imgurl2 = jQuery(‘img’,html).attr(‘src’);
jQuery(‘#favicon’).val(imgurl2);
break;
case ‘add-logo’:
imgurl2 = jQuery(‘img’,html).attr(‘src’);
jQuery(‘#headerlogo’).val(imgurl2);
break;
}
tb_remove();
}

显然这个代码没有问题,之后继续检查,发现没有添加下面的代码:

wp_enqueue_script(‘media-upload’);

这一行代码非常的重要,是用来加载媒体上传对话框的,既然没有出现就加上它。加上后再次测试,那个对话框出现了。目前暂发现此问题,特此记载一下。我们将继续测试。

One thought on “关于优秀主题duotive-three主题后台上传功能失效的解决方法

  1. 我也在使用这个主题,不过发现一些问题,希望能和你探讨一下,www.80h-tv.com 我的QQ是:1294051276 期待你的回复

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注