我的wordpress插件在本地主机上运行得很好,但当我发布帖子时,远程服务器上会显示白色屏幕

我的wordpress插件在本地主机上运行得很好,但当我发布帖子时,远程服务器上会显示白色屏幕,wordpress,Wordpress,这是我的插件代码,激活和停用挂钩在服务器上运行良好,但当我添加HTML部分时,发布帖子后它会显示白色屏幕 register_activation_hook(__FILE__,'hs_install'); register_deactivation_hook(__FILE__,'hs_uninstall'); //<--------- Installation -----------> function hs_install(){ global $wpdb; $table_name1=

这是我的插件代码,激活和停用挂钩在服务器上运行良好,但当我添加HTML部分时,发布帖子后它会显示白色屏幕

register_activation_hook(__FILE__,'hs_install');
register_deactivation_hook(__FILE__,'hs_uninstall');
//<--------- Installation ----------->
function hs_install(){
global $wpdb;
$table_name1=$wpdb->prefix.'hs_image_tag';
 //Table structure for table `image_tag`
    $wpdb->query("CREATE TABLE IF NOT EXISTS $table_name1 (
  id int(11) NOT NULL auto_increment,
  pic_id int(11) NOT NULL,
  name varchar(100) NOT NULL,
  pic_x int(11) NOT NULL,
  pic_y int(11) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY pic_id (pic_id))");

$table_name2=$wpdb->prefix.'hs_categories';
//Table structure for table `wp_hs_categories` `$table_name2`
$query = $wpdb->query("CREATE TABLE IF NOT EXISTS $table_name2 (
 id int(11) NOT NULL AUTO_INCREMENT,
  cat_name varchar(30) NOT NULL,
  PRIMARY KEY (id))");


//Dumping data for table `wp_hs_categories`
if($query)
$wpdb->query("INSERT INTO $table_name2 (id,cat_name) VALUES
(1, 'Fruits'),
(2, 'Cars'),
(3, 'Electronics'),
(4, 'Laptops'),
(5, 'Nature'),
(6, 'Sports'),
(7, 'Cats')");

//--------------------------------------------------------

//Table structure for table `wp_hs_image_details`

$table_name3=$wpdb->prefix.'hs_image_details';
$query = $wpdb->query("CREATE TABLE IF NOT EXISTS $table_name3 (
  id int(11) NOT NULL AUTO_INCREMENT,
  title varchar(30) NOT NULL,
  image_name varchar(30) NOT NULL,
  category varchar(30) NOT NULL,
  last_save varchar(20) NOT NULL,
  path varchar(200) NOT NULL,
  PRIMARY KEY (id)
)");

//Dumping data for table `wp_hs_image_details`

if($query)
$query = $wpdb->query("INSERT INTO $table_name3 
(id,title,image_name,category,last_save,path) VALUES
(1, 'Title 1', 'm1.jpg', 'Electronics', '13-10-2012', 'uploads/m1.jpg'),
(2, 'Title 2', 'm2.jpg', 'Electronics', '13-10-2012', 'uploads/m2.jpg'),
(3, 'Title 3', 'm3.jpg', 'Electronics', '13-10-2012', 'uploads/m3.jpg'),
(4, 'Title 4', 'm4.jpg', 'Electronics', '13-10-2012', 'uploads/m4.jpg'),
(5, 'Title 5', 'car1.jpg', 'Cars', '13-10-2012', 'uploads/car1.jpg'),
(6, 'Title 6', 'car2.jpg', 'Cars', '13-10-2012', 'uploads/car2.jpg'),
(7, 'Title 7', 'car3.jpg', 'Cars', '13-10-2012', 'uploads/car3.jpg'),
(8, 'Title 8', 'car4.jpg', 'Cars', '13-10-2012', 'uploads/car4.jpg'),
(9, 'Title 9', 'cat1.jpg', 'Cats', '13-10-2012', 'uploads/cat1.jpg'),
(10, 'Title 10', 'cat2.jpg', 'Cats', '13-10-2012', 'uploads/cat2.jpg'),
(11, 'Title 11', 'cat3.jpg', 'Cats', '13-10-2012', 'uploads/cat3.jpg'),
(12, 'Title 12', 'cat4.jpg', 'Cats', '13-10-2012', 'uploads/cat4.jpg')");


//--------------------------------------------------------

//Table structure for table `wp_hs_template_images`
$table_name4=$wpdb->prefix.'hs_template_images';

$query = $wpdb->query("CREATE TABLE IF NOT EXISTS $table_name4 (
  id int(11) NOT NULL AUTO_INCREMENT,
  image_name varchar(30) NOT NULL,
  category varchar(30) NOT NULL,
  path varchar(200) NOT NULL,
  PRIMARY KEY (id)
)");

//Dumping data for table `wp_hs_template_images`

if($query)
$wpdb->query("INSERT INTO $table_name4 (id,image_name,category,path) VALUES
(1, 'Laptop 1', 'Laptops', 'template_images/l1.jpg'),
(2, 'Laptop 2', 'Laptops', 'template_images/l2.jpg'),
(3, 'Laptop 3', 'Laptops', 'template_images/l3.jpg'),
(4, 'Laptop 4', 'Laptops', 'template_images/l4.jpg'),
(5, 'Laptop 5', 'Laptops', 'template_images/l5.jpg'),
(6, 'Car 1', 'Cars', 'template_images/c1.jpg'),
(7, 'Car 2', 'Cars', 'template_images/c2.jpg'),
(8, 'Car 3', 'Cars', 'template_images/c3.jpg'),
(9, 'Car 4', 'Cars', 'template_images/c4.jpg'),
(10, 'Car 5', 'Cars', 'template_images/c5.jpg'),
(11, 'Device 1', 'Electronics', 'template_images/e1.jpg'),
(12, 'Device 2', 'Electronics', 'template_images/e2.jpg'),
(13, 'Device 3', 'Electronics', 'template_images/e3.jpg'),
(14, 'Device 4', 'Electronics', 'template_images/e4.jpg'),
(15, 'Device 5', 'Electronics', 'template_images/e5.jpg')");
}
//Table structure for table `wp_hs_categories`
//<--------- Uninstallation ----------->
function hs_uninstall(){
    global $wpdb;
    $table_name1=$wpdb->prefix.'hs_image_tag';
    $table_name2=$wpdb->prefix.'hs_categories';
    $table_name3=$wpdb->prefix.'hs_image_details';
    $table_name4=$wpdb->prefix.'hs_template_images';
    $wpdb->query("DROP TABLE IF EXISTS    
$table_name2,$table_name3,$table_name4,$table_name1");
}
function addYouTube($atts, $content = null) {
        extract(shortcode_atts(array( "id" => '' ), $atts));
        return '<p style="text-align:center"><a href="http://www.youtube.com   
/v/'.$id.'"><img src="http://img.youtube.com/vi/'.$id.'/0.jpg" width="400"   
height="300" class="aligncenter" /><span>Watch the video</span></a></p>';
}
    add_shortcode('youtube', 'addYouTube');

    function add_youtube_button() {
   // Don't bother doing this stuff if the current user lacks permissions
   if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') )
     return;

  // Add only in Rich Editor mode
   if ( get_user_option('rich_editing') == 'true') {
     add_filter("mce_external_plugins", "add_youtube_tinymce_plugin");
     add_filter('mce_buttons', 'register_youtube_button');
     ?>
//the problem is with this section,, i tried placing this section in init_admin() hook
// and related hooks but out of luck.   
<script type="text/javascript" src="<?php echo plugins_url();      
    ?>/brettsyoutube/js/jquery-1.9.0.min.js"></script>
  <script type="text/javascript" src="../wp-content/plugins/brettsyoutube 
/multizoom.js" />
</script>


<!-- Add fancyBox main JS and CSS files -->

<style type="text/css">
#fancy_close{
background: url("<?php echo plugins_url(); ?>/brettsyoutube/images
/fancy_buttons.png")     
repeat scroll 0 0 transparent;
float: right;
height: 34px;
 position: relative;
top: 0;
width: 37px;
z-index: 9800;
display:block;  }   
</style>

     <div id="fancydiv" style="background-color:#FFF;
    display: none;
    height: 540px;
    left: 172px;
    position: absolute;
    top: 298px;
    width: 840px;
    z-index: 999;">
    <span id="fancy_close"></span>


     <div id="myfancybox" style="margin:0; background-color:#FFF;">
<?php global $d_path; 
     $d_path= '../wp-content/plugins/brettsyoutube/';
     include('../wp-content/plugins/brettsyoutube/main.php');?>
     </div>
     <div id="nxt" style="color: red;
    display: none;
    font-size: 38px;
    font-weight: bold;
    height: 100px;
    left: 309px;
    position: absolute;
    top: 489px;
    width: 238px;">Add to post</div>
   </div>
<?php
   }
}

function register_youtube_button($buttons) {
   array_push($buttons, "|", "youryoutube");
   return $buttons;
}

// Load the TinyMCE plugin : editor_plugin.js (wp2.5)
function add_youtube_tinymce_plugin($plugin_array) {
   $plugin_array['youryoutube'] = plugins_url().'/brettsyoutube/editor_plugin.js';
   return $plugin_array;
}

function my_refresh_mce($ver) {
  $ver += 3;
  return $ver;
}

add_filter( 'tiny_mce_version', 'my_refresh_mce');
add_action('init', 'add_youtube_button');
?>
register_activation_hook(__文件,'hs_安装');
注册停用挂钩(uuu文件,'hs_卸载');
//
函数hs_install(){
全球$wpdb;
$table_name1=$wpdb->prefix'hs_image_tag';
//表'image\u标记的表结构`
$wpdb->query(“如果不存在,则创建表$TABLE\u name1(
id int(11)非空自动增量,
PICU id int(11)不为空,
名称varchar(100)不为空,
pic_x int(11)不为空,
picu_y int(11)不为空,
主键(`id`),
密钥pic_id(pic_id))”;
$table_name2=$wpdb->prefix'hs_categories';
//表'wp\u hs\u categories``$Table\u name2的表结构`
$query=$wpdb->query(“如果不存在,则创建表$TABLE\u name2(
id int(11)非空自动增量,
cat_名称varchar(30)不为空,
主键(id));
//表'wp\U hs\U类别的转储数据`
如果($query)
$wpdb->query(“插入到$table\u name2(id,cat\u name)值中
(1,'水果'),
(二"汽车"),,
(3"电子学"),,
(4,“笔记本电脑”),
(5,“性质”),
(6"体育"),,
(七)"猫";;
//--------------------------------------------------------
//表'wp\u hs\u image\u详细信息的表结构`
$table_name3=$wpdb->prefix'hs_image_details';
$query=$wpdb->query(“如果不存在,则创建表$TABLE\u name3(
id int(11)非空自动增量,
标题varchar(30)不为空,
图像名称varchar(30)不为空,
类别varchar(30)不为空,
最后一次保存varchar(20)不为空,
路径varchar(200)不为空,
主键(id)
)");
//正在转储表'wp\u hs\u image\u details'的数据`
如果($query)
$query=$wpdb->query(“插入到$table\u name3中
(id、标题、图像名称、类别、上次保存、路径)值
(1,“标题1”、“m1.jpg”、“电子”、“2012年10月13日”、“上传/m1.jpg”),
(2,“标题2”、“m2.jpg”、“电子”、“2012年10月13日”、“上传/m2.jpg”),
(3,“标题3”、“m3.jpg”、“电子”、“2012年10月13日”、“上传/m3.jpg”),
(4,“标题4”、“m4.jpg”、“电子”、“2012年10月13日”、“上传/m4.jpg”),
(5,“标题5”、“car1.jpg”、“Cars”、“13-10-2012”、“上传/car1.jpg”),
(6,“标题6”、“car2.jpg”、“Cars”、“13-10-2012”、“上传/car2.jpg”),
(7,“标题7”、“car3.jpg”、“Cars”、“2012年10月13日”、“上传/car3.jpg”),
(8,“标题8”、“car4.jpg”、“Cars”、“2012年10月13日”、“上传/car4.jpg”),
(9,“标题9”、“cat1.jpg”、“Cats”、“13-10-2012”、“上传/cat1.jpg”),
(10,'Title 10'、'cat2.jpg'、'Cats'、'13-10-2012'、'uploads/cat2.jpg'),
(11,“标题11”、“cat3.jpg”、“Cats”、“13-10-2012”、“上传/cat3.jpg”),
(12,“标题12”、“cat4.jpg”、“Cats”、“13-10-2012”、“上传/cat4.jpg”);
//--------------------------------------------------------
//表'wp\u hs\u模板\u图像的表结构`
$table_name4=$wpdb->prefix'hs_template_images';
$query=$wpdb->query(“如果不存在,则创建表$TABLE\u name 4(
id int(11)非空自动增量,
图像名称varchar(30)不为空,
类别varchar(30)不为空,
路径varchar(200)不为空,
主键(id)
)");
//正在转储表'wp\u hs\u template\u图像的数据`
如果($query)
$wpdb->query(“插入到$table\u name4(id、图像\u名称、类别、路径)值中
(1,“笔记本电脑1”、“笔记本电脑”、“模板图像/l1.jpg”),
(2,“笔记本电脑2”、“笔记本电脑”、“模板图像/l2.jpg”),
(3,“笔记本电脑3”、“笔记本电脑”、“模板图像/l3.jpg”),
(4、“笔记本电脑4”、“笔记本电脑”、“模板图像/l4.jpg”),
(5,“笔记本电脑5”、“笔记本电脑”、“模板图像/l5.jpg”),
(6,'Car 1'、'Cars'、'template_images/c1.jpg'),
(7,“汽车2”、“汽车”、“模板图像/c2.jpg”),
(8,“汽车3”、“汽车”、“模板图像/c3.jpg”),
(9、“汽车4”、“汽车”、“模板图像/c4.jpg”),
(10、“汽车5”、“汽车”、“模板图像/c5.jpg”),
(11,“设备1”、“电子设备”、“模板图像/e1.jpg”),
(12,“设备2”、“电子设备”、“模板图像/e2.jpg”),
(13,“设备3”、“电子设备”、“模板图像/e3.jpg”),
(14,“设备4”、“电子设备”、“模板图像/e4.jpg”),
(15,“设备5”、“电子设备”、“模板图像/e5.jpg”);
}
//表'wp\U hs\U类别的表结构`
//
函数hs_uninstall(){
全球$wpdb;
$table_name1=$wpdb->prefix'hs_image_tag';
$table_name2=$wpdb->prefix'hs_categories';
$table_name3=$wpdb->prefix'hs_image_details';
$table_name4=$wpdb->prefix'hs_template_images';
$wpdb->query(“如果存在,则删除表
$table_name2、$table_name3、$table_name4、$table_name1”);
}
函数addYouTube($atts,$content=null){
提取(短码_atts(数组(“id”=>”,$atts));
返回“

”; } 添加_短代码('youtube','addYouTube'); 函数添加按钮(){ //如果当前用户没有权限,不要费心做这些事情 如果(!current_user_can('edit_posts')&&!current_user_can('edit_pages')) 返回; //仅在富编辑器模式下添加 如果(获取用户选项('rich\u editing')=='true'){ 添加过滤器(“mce_外部插件”、“添加youtube_tinymce_插件”); 添加过滤器(“mce按钮”、“注册youtube按钮”); ?> //问题在于此节,我尝试将此节放置在init_admin()钩子中 //和相关的钩子,但运气不好。 添加到邮件
wp config.php
文件中设置为
true
,您将能够看到哪个错误导致出现白色屏幕