i try plugin wordpress working stand in front of wall.
problem if call class gbl_extras error occured:
catchable fatal error: object of class gbl_extras not converted string in /wp-includes/functions.php on line 1592
don't figure out why happen. if delete add_submenu_page methods class render correctly, didn't mistake there.
if read many other articles same problems can't adapt problem error project.
there can bring little bit light in darkness?
my code:
<?php // don't load directly if ( ! defined( 'abspath' ) ) { die( '-1' ); } if ( ! class_exists( 'gbl_extras' ) ) { class gbl_extras { private static $_instance; private function __construct() { // add hooks add_action( 'network_admin_menu', array( $this, 'init' )); } public static function getinstance() { if ( ! ( self::$_instance instanceof self ) ) { self::$_instance = new self(); } return self::$_instance; } public function init() { add_menu_page( 'extrawünsche', 'extrawünsche', 'manage_options', 'gbl_extras_settings'); add_submenu_page( 'gbl_extras_settings', 'alle extrawünsche', 'alle extrawünsche', 'manage_options', array( $this, 'backendrenderextras')); add_submenu_page( 'gbl_extras_settings', 'kategorien', 'kategorien', 'manage_options', 'gbl_extras_categories', array( $this, 'backendrendercategories')); } public function backendrenderextras() { ?> <div class="wrap"> <div id="icon-users" class="icon32"><br/></div> <h2>extrawünsche</h2> </div> <?php } public function backendrendercategories() { ?> <div class="wrap"> <h2>kategorien</h2> </div> <?php } } $gbl_manager = gbl_extras::getinstance(); } ?>
looks first add_submenu_page() call missing $menu_slug argument. compare end of 2 calls:
'manage_options', array( $this, 'backendrenderextras')); and
'manage_options', 'gbl_extras_categories', array( $this, 'backendrendercategories')); the second 1 looks correct.
Comments
Post a Comment