0

While of activation of plugin of wordpress developed by my self getting error is : The plugin generated 6 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.!

This is the code of plugin please tell me the reson thanks i 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       
            }
}
?>
srinivas
  • 109
  • 12
  • Possible duplicate of [The plugin generated X characters of unexpected output during activation (WordPress)](https://stackoverflow.com/questions/4074477/the-plugin-generated-x-characters-of-unexpected-output-during-activation-wordpr) – T.Todua Dec 24 '18 at 00:04

1 Answers1

0

I checked your code there is nothing wrong in it. it works fine and i have activated the plugins successfully. I will advice you to check your wordpress installation files. If everything is ok, then try deactivating other plugins you have.

MMK
  • 609
  • 5
  • 16
  • can i include the css code inside of top of this plugin. – srinivas Feb 25 '15 at 01:46
  • It is working fine but it generates error is: The plugin generated 6 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.! – srinivas Feb 25 '15 at 04:09
  • yes you can include css inside a plugin. Like so `add_action('admin_enqueue_scripts','My_styles_scripts'); function My_styles_scripts(){ $screen = get_current_screen(); if ( 'your_page_id_here' == $screen->id ){ wp_enqueue_style('My_CSS', plugins_url('css/My.css',__FILE__) ); } }` That is linking an external file. – MMK Feb 25 '15 at 10:32