• Resolved Boris

    (@ispacecrusader)


    I’ve created my own plugin. Everything works fine, except that the admin page I made loads above every page in the WP-admin. It loads within the wrap class, but instead of dropping within the existing wrap class, creates a second wrap class location at the top, even before the doctype declaration. I’ve searched for days for a solution, but cannot find it. Is there anyone who can help me? The code exists of two PHP files, I’ll show the code in the PHP file that sets the admin page:

    <?php
    /*
    Plugin Name: Verkoopstatus
    Version: 1.0
    */
    ?>
    <?php
    define( 'PLUGIN_DIR', dirname(__FILE__).'/' );
    if ( is_admin() ) { //run only in WP admin area
    }
    add_action( 'admin_menu' , 'verkoopstatus_admin_menu' );
    function verkoopstatus_admin_menu() {
       	add_menu_page('Beheer verkoopstatus', 'Verkoopstatus', 'manage_options', 'Verkoopstatus', 'showHome', plugins_url('verkoopstatus/images/verkoopstatus-icon-2.png', 99) );
    	include( plugin_dir_path( __FILE__ ) . 'verkoopstatus.php');
    }
    ?>

Viewing 1 replies (of 1 total)
  • Thread Starter Boris

    (@ispacecrusader)

    Found the solution! I’ll paste it here, maybe it’ll help someone else:

    <?php
    define( 'PLUGIN_DIR', dirname(__FILE__).'/' );
    
    add_action( 'admin_menu', 'verkoopstatus_admin_menu' );
    
    function verkoopstatus_admin_menu() {
       	add_menu_page('Beheer verkoopstatus', 'Verkoopstatus', 'manage_options', 'Verkoopstatus', 'verkoopstatus_admin_options', plugins_url('verkoopstatus/images/verkoopstatus-icon-2.png', 99) );
    }
    
    function verkoopstatus_admin_options() {
    	if (!is_admin()) {
    	}
    	echo '<div class="wrap">';
    	include( plugin_dir_path( __FILE__ ) . 'verkoopstatus.php');
    	echo '</div>';
    }
    ?>

Viewing 1 replies (of 1 total)
  • The topic ‘My plugin loads at the top of every WP-admin page’ is closed to new replies.