2013-06-01 22 views
0

給我:爲什麼我的WordPress插件,當我安裝這個WordPress插件它reciving「意外輸出」

The plugin generated 189 characters of unexpected output during activation. If you notice 「headers already sent」 messages, problems with syndication feeds or other issues, try deactivating or removing this plugin. 

這是我的代碼:

add_action('wp_head', 'wpse_43672_wp_head', 0); 
/** 
* Hooks into the `wp_head` action. 
*/ 
function wpse_43672_wp_head(){ ?> 
     <script> 
     if (navigator.userAgent.match(/Android/i) || 
      navigator.userAgent.match(/webOS/i) || 
      navigator.userAgent.match(/iPhone/i) || 
      navigator.userAgent.match(/iPad/i) || 
      navigator.userAgent.match(/iPod/i) || 
      navigator.userAgent.match(/BlackBerry/) || 
      navigator.userAgent.match(/Windows Phone/i) || 
      navigator.userAgent.match(/ZuneWP7/i) 
      ) { 
       // some code 
       self.location="<?php echo plugins_url(); ?>/zeevmobile/mobile-page.php"; 
       } 
     </script> 
<?php }?> 
<style> 
li#toplevel_page_zeevmobile-zeevmobile .wp-menu-image { 
    background: url(<?php echo plugins_url(); ?>/zeevmobile/images/icon.png) no-repeat 4px !important; 
} 
</style> 
<?php 
// create custom plugin settings menu 
add_action('admin_menu', 'zeev_create_menu'); 
function zeev_create_menu() { 
    //create new top-level menu 
    add_menu_page('zeev movile redirect', 'zeev mobile', 'administrator', __FILE__, 'zeev_settings_page'); 
     //create new top-level menu 
    //call register settings function 
    add_action('admin_init', 'register_mysettings'); 
} 
function register_mysettings() { 
    //register our settings 
    register_setting('zeev-settings-group', 'zeev_above_text'); 
    register_setting('zeev-settings-group', 'zeev_normal_site'); 
    register_setting('zeev-settings-group', 'zeev_mobile_site'); 
} 
function zeev_settings_page() { 
?> 
<div class="wrap"> 
<h2>Your Mobile Buttons Links</h2> 
<form method="post" action="options.php">  
    <?php settings_fields('zeev-settings-group'); ?> 
    <table class="form-table"> 
     <tr valign="top"> 
     <th scope="row">Some text above buttons</th> 
     <td><textarea name="zeev_above_text" cols="90"><?php echo get_option('zeev_above_text'); ?></textarea></td> 
     </tr> 
     <tr valign="top"> 
     <th scope="row">Normal Site Link</th> 
     <td><textarea name="zeev_normal_site" cols="90"><?php echo get_option('zeev_normal_site'); ?></textarea></td> 
     </tr> 
     <tr valign="top"> 
     <th scope="row">Mobile Site Link</th> 
     <td><textarea name="zeev_mobile_site" cols="90"><?php echo get_option('zeev_mobile_site'); ?></textarea></td> 
     </tr>   
    </table>  
    <p class="submit"> 
    <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" /> 
    </p> 
</form> 
</div> 
<?php }?> 

我知道,「意外輸出」問題來自這個文件,因爲當我刪除所有的PHP中,我不明白這個問題。 你能幫我解決嗎? 我上傳了這裏: http://zeevm.co.il/zeev-mobile-new.zip

+0

難道你不是最初就缺少'<?php'嗎? –

+0

沒有:)我把插件的一部分沒有開始的東西(插件作者和類似的東西) – user2440873

+0

也許你在最後有足夠的空白,然後......錯誤消息基本上是WP抱怨某事是在包含文件時得到迴應。 –

回答

0

每個評論,錯誤信息基本上是WP抱怨說,當文件被包括時,某些東西得到迴應。

從粗略看一下你的代碼,它看起來像你的<style>標記得到了回顯 - 它不在函數範圍內。插件中的其他地方可能還有其他類似的問題。

+0

好的問題是沒有就位的CSS – user2440873

相關問題