0
votes

What am I doing wrong....this doesnt seem to work... I keep getting the following error

Warning: Cannot modify header information - headers already sent by (output started at /home/puretige/public_html/wp-content/plugins/Pure Tiger/puretiger.php:13) in /home/puretige/public_html/wp-includes/option.php on line 568

Warning: Cannot modify header information - headers already sent by (output started at /home/puretige/public_html/wp-content/plugins/Pure Tiger/puretiger.php:13) in /home/puretige/public_html/wp-includes/option.php on line 569

The plugin generated 2 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.

Please note I am very new to this....

<?php
/*
Plugin Name: Pure Tiger Hosting
Plugin URI: http://www.puretigerhosting.com/wordpressplugin
Description: Themes, Plugins and Support from within your admin panel.
Version: 1.00
Author: Pure Tiger Hosting
Author URI: http://www.puretigerhosting.com
License: GPL2
*/
?>

<?php

add_action('admin_menu','register_custom_menu_page');

add_action('admin_menu','register_my_custom_submenu_page');

add_action('admin_menu','register_my_custom_submenu_page2');

add_action('admin_menu','register_my_custom_submenu_page3');



Function register_custom_menu_page() {

    add_menu_page('Pure Tiger', 'Pure Tiger','pure-tiger','add_users','','', 6);
}


/*-----------------------------Sub Pages--------------------------------------------*/


function register_my_custom_submenu_page() {
    add_submenu_page( 'pure-tiger','Themes','Themes','PTthemes','','','my_custom_submenu_page_themes');
}

function register_my_custom_submenu_page2() {
    add_submenu_page( 'pure-tiger','Plugins','Plugins','PTPlugins','','','my_custom_submenu_page_plugins');
}

function register_my_custom_submenu_page3() {
    add_submenu_page( 'pure-tiger','Ask a Question','Ask a Question','question','','','my_custom_submenu_page_question');
}


/*-----------------------------Themes--------------------------------------------*/

function my_custom_submenu_page_themes() {
    echo '<h3>Pure Tiger Themes</h3>';
}


/*-----------------------------Plugins--------------------------------------------*/

function my_custom_submenu_page_plugins() {
    echo '<h3>Pure Tiger Plugins</h3>';
}


/*-----------------------------Support--------------------------------------------*/

function my_custom_submenu_page_question() {
    echo '<h3>Pure Tiger Support</h3>';
}

?>
3

3 Answers

0
votes

Try removing the open close php tags before your plugin declaration.

/*
Plugin Name: Pure Tiger Hosting
Plugin URI: http://www.puretigerhosting.com/wordpressplugin
Description: Themes, Plugins and Support from within your admin panel.
Version: 1.00
Author: Pure Tiger Hosting
Author URI: http://www.puretigerhosting.com
License: GPL2
*/



<?php

add_action('admin_menu','register_custom_menu_page');
//remaining code to follow....
0
votes

Remove close ?> and open <?php tags after copyright notice. 2 newline prevent wordpress from sending headers.

<?php
/*
Plugin Name: Pure Tiger Hosting
Plugin URI: http://www.puretigerhosting.com/wordpressplugin
Description: Themes, Plugins and Support from within your admin panel.
Version: 1.00
Author: Pure Tiger Hosting
Author URI: http://www.puretigerhosting.com
License: GPL2
*/

add_action('admin_menu','register_custom_menu_page');

add_action('admin_menu','register_my_custom_submenu_page');
-1
votes

Check if this plugin trys to write a cookie.

If this is the case, then your plugin has to be initiated BEFORE any html code processing. So you have to initiate the plugin in the top of your index.php, before the <!doctype ... >

Some reading about cookies : http://php.net/manual/en/features.cookies.php