Hi,
i have created a Wordpress-Plugin and now I am solving some open issues. I have used "DX Plugin Base" as base for my plugin.
My plugin has ist own menu in wordpress-backend.
It is working, but I think I didn't make it right.
Please find below the relevant code I use for my admin-menu:
class myplugin_Plugin_Base {
function __construct() {
// register admin pages for the plugin
add_action( 'admin_menu', array( $this, 'myplugin_admin_pages_callback' ) );
}
// Menüpunkte im Wordpress-Backend bzw. Dashboard registrieren
function myplugin_admin_pages_callback() {
add_menu_page(__( "myplugin", 'myplugin' ), __( "myplugin", 'myplugin' ), 'edit_themes', 'myplugin_setup', array( $this, 'myplugin_setup' ), 'dashicons-cart' );
}
function myplugin_setup() {
include_once( myplugin_PATH . '/myplugin-backend.php' );
}
}
I only want to have ONE single menu-item.
I have read somewhere, that I have to create a top-level-menu, like I did with the code above.
Also I would have to create a sub-level-menu item?
I don't know. Could anybody help me with it?