2015-02-24 40 views
0

雖然我自己開發的wordpress插件激活得到錯誤,但是激活時插件生成了6個字符的意外輸出。如果您注意到「標題已發送」消息,聯合供稿或與其他問題有關的問題,請嘗試停用或刪除此插件。雖然激活我自己開發的wordpress插件得到錯誤

這是插件的代碼,請告訴我振振有辭感謝我advace

<?php 
/* 
Plugin Name: MNG image effect wp - options 
Plugin URI: http://mngitservices.com/ 
Description: This is the plugin used for a gallery page of images or can be used in frent of the webpage apear much effectively. 
Author: srinivas 
version:1.0 
Author URI: http://mngitservices.com/ 
*/ 

add_action('admin_menu', 'my_plugin_image'); 
function my_plugin_image() { 
    add_options_page('MNG image effect', 'MNG_image_effect', 'manage_options',__FILE__, 'my_plugin_options_images'); 
} 

// showing in the page 
function my_plugin_options_images() { 
add_option('mng_image_plugin',array(
'1'=> 'url1', 
'2' => 'url2' 
)); 

if($_POST['mng_gallery']){ 
$frent_image = $_POST['frent_img1']; 
$back_image = $_POST['back_img1']; 
$new_mng_images = array($frent_image,$back_image); 
$new_mng_images_options = get_option('mng_image_plugin'); // Getting array from the database of wp options 
$new_mng_images = array_merge(array_values($new_mng_images), array_values($new_mng_images_options)); 

//$new_mng_images = array_push($new_mng_images_options); 
update_option('mng_image_plugin',$new_mng_images); 
echo 'Updated Successfully'; 
} 
?> 
<form action='options-general.php?page=mngimageeffects/mngimageeffects.php' method ="post" > 
    <div class="col-md-12"> 
    <div class="form-group"> 
    <label for="exampleInputEmail1">Frent images</label> 
    <input type="text" name="frent_img1" class="form-control" id="exampleInputEmail1" placeholder="frent image"> 
    </div> 
    <div class="form-group"> 
    <label for="exampleInputPassword1">Back images</label> 
    <input type="text" class="form-control" name="back_img1" id="exampleInputPassword1" placeholder="back image"> 
    </div> 
    <input type="submit" value="submit" name="mng_gallery" class="btn btn-primary"> 
    </div> 
    </form>  
    <?php 
}  
add_shortcode('mng_gallery_images','mng_gallery_images'); 
    function mng_gallery_images(){ 
    // Dynamic Slider 
    $mng_gallery_images = get_option('mng_image_plugin'); 
    foreach($mng_gallery_images as $option) { 
     ?> 
     <div class="col-md-3"> 
     <img src="<?php echo $option; ?>" class="thumbnail" alt="..." width="100%"> 
     </div>  
     <?php  
      } 
} 
?> 

回答

0

我檢查你的代碼有什麼錯吧。它工作正常,我已經成功地激活了插件。我會建議你檢查你的wordpress安裝文件。如果一切正常,然後嘗試停用您擁有的其他插件。

+0

我可以在這個插件的頂部包含CSS代碼。 – srinivas 2015-02-25 01:46:43

+0

它工作正常,但它產生的錯誤是:該插件在激活期間生成了6個字符的意外輸出。如果您注意到「標題已發送」消息,聯合供稿或與其他問題有關的問題,請嘗試停用或刪除此插件。 – srinivas 2015-02-25 04:09:43

+0

是的,你可以在插件中包含css。 \t像這樣'add_action('admin_enqueue_scripts','My_styles_scripts'); (){ \t function My_styles_scripts(){ \t \t $ screen = get_current_screen(); ('your_page_id_here'== $ screen-> id){ \t \t wp_enqueue_style('My_CSS',plugins_url('css/My.css',__ FILE__)); \t \t} \t}'這是連接一個外部文件。 – MMK 2015-02-25 10:32:47

相關問題